1
from calculus.base_2 import Calculation
2
from twisted.trial import unittest
6
class CalculationTestCase(unittest.TestCase):
8
self.calc = Calculation()
11
def _test(self, operation, a, b, expected):
12
result = operation(a, b)
13
self.assertEqual(result, expected)
17
self._test(self.calc.add, 3, 8, 11)
20
def test_subtract(self):
21
self._test(self.calc.subtract, 7, 3, 4)
24
def test_multiply(self):
25
self._test(self.calc.multiply, 6, 9, 54)
28
def test_divide(self):
29
self._test(self.calc.divide, 12, 5, 2)