-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathtest.py
More file actions
26 lines (21 loc) · 683 Bytes
/
test.py
File metadata and controls
26 lines (21 loc) · 683 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import unittest
from example import ArithmeticPair as AP
class TestArithmetic(unittest.TestCase):
def test_sum(self):
ap = AP(15, 3)
ret = ap.sum()
self.assertEqual(ret, 18, f"error in sum")
def test_difference(self):
ap = AP(15, 3)
ret = ap.difference()
self.assertEqual(ret, 12, f"error in difference")
def test_product(self):
ap = AP(15, 3)
ret = ap.product()
self.assertEqual(ret, 45, f"error in product")
def test_quotient(self):
ap = AP(15, 3)
ret = ap.quotient()
self.assertEqual(ret, 5.0, f"error in quotient")
if __name__ == "__main__":
unittest.main()