예제 #1
0
class TestMathMethods(unittest.TestCase):
    def setUp(self):
        self.unit = MathMethods()

    def tearDown(self):
        del self.unit

    def test_add_two_zero(self):
        res = self.unit.add(0, 0)
        print('两个0相加', res)
        self.assertEqual(0, res)

    def test_add_two_positive(self):
        res = self.unit.add(1, 8)
        print('两个正数相加', res)
        self.assertEqual(9, res)

    def test_add_two_negative(self):
        res = self.unit.add(-1, -4)
        print('两个负数相加', res)
        self.assertEqual(-5, res)
예제 #2
0
 def setUp(self):
     self.unit = MathMethods()
예제 #3
0
 def test_add_two_negative(self):
     res = MathMethods().add(-1, -4)
     print('两个负数相加', res)
     self.assertEqual(-5, res)
예제 #4
0
 def test_add_two_zero(self):
     res = MathMethods().add(0, 0)
     print('两个0相加', res)
     self.assertEqual(0, res)
예제 #5
0
 def test_add_two_positive(self):
     res = MathMethods().add(1, 8)
     print('两个正数相加', res)
     self.assertEqual(9, res)