Skip to content

Commit db658fb

Browse files
authored
Create test_app.py
1 parent dc7f4e9 commit db658fb

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

app/test_app.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import unittest
2+
3+
from logic import check_posted_data
4+
5+
6+
class TestSnippet(unittest.TestCase):
7+
8+
def test_check_posted_data_first_set(self):
9+
# testing the check_posted_data method with different input sets
10+
11+
print(f"Testing function - {check_posted_data.__name__} Set 1")
12+
13+
data_list = [[{"x": 184, "y": 323}, "add", 200], [{"x": 143, "y": 0}, "division", 302], [{"x": 142}, "division",
14+
301]]
15+
16+
for data in data_list:
17+
result = check_posted_data(data[0], data[1])
18+
19+
self.assertEqual(result, data[2])
20+
21+
print(f"Test data - {data}")
22+
23+
def test_check_posted_data_second_set(self):
24+
print(f"Testing function - {check_posted_data.__name__} Set 2")
25+
data_list = [[{"x": 184, "y": 323}, "add", 200], [{"x": 143, "y": 0}, "division", 302], [{"y": 143}, "division",
26+
301]]
27+
28+
for data in data_list:
29+
result = check_posted_data(data[0], data[1])
30+
31+
self.assertEqual(result, data[2])
32+
33+
print(f"Test data - {data}")
34+
35+
36+
if __name__ == "__main__":
37+
import xmlrunner
38+
39+
unittest.main(testRunner=xmlrunner.XMLTestRunner(output='test_reports'))

0 commit comments

Comments
 (0)