on master help sign in
Added Basic python test file
commitca5793dbea60d7b11643a508b618ca7a4fb11e9e authoradgai19 <gaitondeaditya@gmail.com> dateSun 4 Oct 2020, 01:11 (6 years ago) parent0fdaa8e
2 files changed+190
tests/syntax-tests/highlighted/Python/battest.py+95 tests/syntax-tests/source/Python/battest.py+95
tests/syntax-tests/highlighted/Python/battest.pynew file+95
@@ -0,0 +1,95 @@
1+from os import getcwd
2+import numpy as np
3+from matplotlib.pyplot import plot as plt
4+from time import *
5+
6+
7+# COMMENT test
8+h2 = 4 # this is a comment
9+"""this is also a comment"""
10+
11+# Import testt
12+
13+# class test
14+
15+
16+class Hello:
17+ def __init__(self, x):
18+ self.name = x
19+
20+ def selfprint(self):
21+ print("hello my name is ", self.name)
22+
23+ def testprint(self):
24+ print(1*2, 2+3, 4 % 5, 8-4, 9/4, 23//4)
25+
26+
27+H1 = Hello("john")
28+H1.selfprint()
29+H1.testprint()
30+
31+
32+# list test
33+a = [1, 2, 3, 4, 5]
34+a.sort()
35+print(a[1:3])
36+print(a[:4])
37+print(a[2])
38+print(a[2:])
39+
40+# dictioary test
41+# copied from w3school example
42+
43+myfamily = {
44+ "child1": {
45+ "name": "Emil",
46+ "year": 2004
47+ },
48+ "child2": {
49+ "name": "Tobias",
50+ "year": 2007
51+ },
52+ "child3": {
53+ "name": "Linus",
54+ "year": 2011
55+ }
56+}
57+
58+# touple test
59+
60+testTuple = ("one", 2, "3")
61+print(testTuple)
62+
63+print(np.random.randint(5, 45))
64+
65+# string test
66+a = "hello world"
67+b = """good morning
68+hello world
69+bye"""
70+
71+formattest = "teststring is ={}".format(5)
72+
73+# lamda test
74+
75+
76+def x2(n):
77+ lambda n: n/7
78+
79+
80+# if else ladder
81+if 1 > 2:
82+ print("yes")
83+elif 4 > 5:
84+ print("maybe")
85+else:
86+ print("no")
87+
88+# loops
89+i = 5
90+while(i > 0):
91+ print(i)
92+ i -= 1
93+
94+for x in range(1, 20, 2):
95+ print(x)
tests/syntax-tests/source/Python/battest.pynew file+95
@@ -0,0 +1,95 @@
1+from os import getcwd
2+import numpy as np
3+from matplotlib.pyplot import plot as plt
4+from time import *
5+
6+
7+# COMMENT test
8+h2 = 4 # this is a comment
9+"""this is also a comment"""
10+
11+# Import testt
12+
13+# class test
14+
15+
16+class Hello:
17+ def __init__(self, x):
18+ self.name = x
19+
20+ def selfprint(self):
21+ print("hello my name is ", self.name)
22+
23+ def testprint(self):
24+ print(1*2, 2+3, 4 % 5, 8-4, 9/4, 23//4)
25+
26+
27+H1 = Hello("john")
28+H1.selfprint()
29+H1.testprint()
30+
31+
32+# list test
33+a = [1, 2, 3, 4, 5]
34+a.sort()
35+print(a[1:3])
36+print(a[:4])
37+print(a[2])
38+print(a[2:])
39+
40+# dictioary test
41+# copied from w3school example
42+
43+myfamily = {
44+ "child1": {
45+ "name": "Emil",
46+ "year": 2004
47+ },
48+ "child2": {
49+ "name": "Tobias",
50+ "year": 2007
51+ },
52+ "child3": {
53+ "name": "Linus",
54+ "year": 2011
55+ }
56+}
57+
58+# touple test
59+
60+testTuple = ("one", 2, "3")
61+print(testTuple)
62+
63+print(np.random.randint(5, 45))
64+
65+# string test
66+a = "hello world"
67+b = """good morning
68+hello world
69+bye"""
70+
71+formattest = "teststring is ={}".format(5)
72+
73+# lamda test
74+
75+
76+def x2(n):
77+ lambda n: n/7
78+
79+
80+# if else ladder
81+if 1 > 2:
82+ print("yes")
83+elif 4 > 5:
84+ print("maybe")
85+else:
86+ print("no")
87+
88+# loops
89+i = 5
90+while(i > 0):
91+ print(i)
92+ i -= 1
93+
94+for x in range(1, 20, 2):
95+ print(x)