summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoradgai19 <gaitondeaditya@gmail.com>2020-10-04 01:11:52 +0530
committerDavid Peter <sharkdp@users.noreply.github.com>2020-10-03 22:32:59 +0200
commitca5793dbea60d7b11643a508b618ca7a4fb11e9e (patch)
treed7637f8e8f0dd32b1414a870def57e611fe285c9 /tests
parent0fdaa8e7451c192908f50269125b0d8c5e5d8575 (diff)
Added Basic python test file
Diffstat (limited to 'tests')
-rw-r--r--tests/syntax-tests/highlighted/Python/battest.py95
-rw-r--r--tests/syntax-tests/source/Python/battest.py95
2 files changed, 190 insertions, 0 deletions
diff --git a/tests/syntax-tests/highlighted/Python/battest.py b/tests/syntax-tests/highlighted/Python/battest.py
new file mode 100644
index 00000000..863f22a6
--- /dev/null
+++ b/tests/syntax-tests/highlighted/Python/battest.py
@@ -0,0 +1,95 @@
+from os import getcwd
+import numpy as np
+from matplotlib.pyplot import plot as plt
+from time import *
+
+
+# COMMENT test
+h2 = 4 # this is a comment
+"""this is also a comment"""
+
+# Import testt
+
+# class test
+
+
+class Hello:
+ def __init__(self, x):
+ self.name = x
+
+ def selfprint(self):
+ print("hello my name is ", self.name)
+
+ def testprint(self):
+ print(1*2, 2+3, 4 % 5, 8-4, 9/4, 23//4)
+
+
+H1 = Hello("john")
+H1.selfprint()
+H1.testprint()
+
+
+# list test
+a = [1, 2, 3, 4, 5]
+a.sort()
+print(a[1:3])
+print(a[:4])
+print(a[2])
+print(a[2:])
+
+# dictioary test
+# copied from w3school example
+
+myfamily = {
+ "child1": {
+ "name": "Emil",
+ "year": 2004
+ },
+ "child2": {
+ "name": "Tobias",
+ "year": 2007
+ },
+ "child3": {
+ "name": "Linus",
+ "year": 2011
+ }
+}
+
+# touple test
+
+testTuple = ("one", 2, "3")
+print(testTuple)
+
+print(np.random.randint(5, 45))
+
+# string test
+a = "hello world"
+b = """good morning
+hello world
+bye"""
+
+formattest = "teststring is ={}".format(5)
+
+# lamda test
+
+
+def x2(n):
+ lambda n: n/7
+
+
+# if else ladder
+if 1 > 2:
+ print("yes")
+elif 4 > 5:
+ print("maybe")
+else:
+ print("no")
+
+# loops
+i = 5
+while(i > 0):
+ print(i)
+ i -= 1
+
+for x in range(1, 20, 2):
+ print(x)
diff --git a/tests/syntax-tests/source/Python/battest.py b/tests/syntax-tests/source/Python/battest.py
new file mode 100644
index 00000000..92be0ef6
--- /dev/null
+++ b/tests/syntax-tests/source/Python/battest.py
@@ -0,0 +1,95 @@
+from os import getcwd
+import numpy as np
+from matplotlib.pyplot import plot as plt
+from time import *
+
+
+# COMMENT test
+h2 = 4 # this is a comment
+"""this is also a comment"""
+
+# Import testt
+
+# class test
+
+
+class Hello:
+ def __init__(self, x):
+ self.name = x
+
+ def selfprint(self):
+ print("hello my name is ", self.name)
+
+ def testprint(self):
+ print(1*2, 2+3, 4 % 5, 8-4, 9/4, 23//4)
+
+
+H1 = Hello("john")
+H1.selfprint()
+H1.testprint()
+
+
+# list test
+a = [1, 2, 3, 4, 5]
+a.sort()
+print(a[1:3])
+print(a[:4])
+print(a[2])
+print(a[2:])
+
+# dictioary test
+# copied from w3school example
+
+myfamily = {
+ "child1": {
+ "name": "Emil",
+ "year": 2004
+ },
+ "child2": {
+ "name": "Tobias",
+ "year": 2007
+ },
+ "child3": {
+ "name": "Linus",
+ "year": 2011
+ }
+}
+
+# touple test
+
+testTuple = ("one", 2, "3")
+print(testTuple)
+
+print(np.random.randint(5, 45))
+
+# string test
+a = "hello world"
+b = """good morning
+hello world
+bye"""
+
+formattest = "teststring is ={}".format(5)
+
+# lamda test
+
+
+def x2(n):
+ lambda n: n/7
+
+
+# if else ladder
+if 1 > 2:
+ print("yes")
+elif 4 > 5:
+ print("maybe")
+else:
+ print("no")
+
+# loops
+i = 5
+while(i > 0):
+ print(i)
+ i -= 1
+
+for x in range(1, 20, 2):
+ print(x)