-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestCalculator.py
More file actions
38 lines (27 loc) · 899 Bytes
/
Copy pathtestCalculator.py
File metadata and controls
38 lines (27 loc) · 899 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
27
28
29
30
31
32
33
34
35
36
37
38
import unittest
from Calculator import Calculator
class testSumFromNumbers(unittest.TestCase):
def test_isCorect(self):
calc = Calculator()
result = calc.sumFromNumbers(2,3)
expected = 5
self.assertEqual(result,expected)
def test_isNegative(self):
calc = Calculator()
result = calc.sumFromNumbers(-4,1)
expected = 0
self.assertLess(result,expected)
def test_isGreater(self):
calc = Calculator()
result = calc.sumFromNumbers(2,3)
expected = 5
self.assertGreaterEqual(result,expected)
def suite():
# gather all tests in a test suite
test_suite = unittest.TestSuite()
test_suite.addTest(unittest.makeSuite(testSumFromNumbers))
return test_suite
mySuite=suite()
#define Runner
runner=unittest.TextTestRunner()
runner.run(mySuite)