def test_diff_many_digits(self): calc = Calculator("5,4,3,2,1") self.assertEqual(calc.diff(), -5)
def test_diff_three_digits(self): calc = Calculator("3,2,1") self.assertEqual(calc.diff(), 0)
def test_diff_one_digit(self): calc = Calculator("1") with self.assertRaises(ValueError): calc.diff()
def test_diff_two_digits(self): calc = Calculator("1,0") self.assertEqual(calc.diff(), 1)
print "8. Fail!!" calc = Calculator("1,2,3") if calc.add() == 6: print "9. Success!" else: print "9. Fail!!" calc = Calculator("1,2,3,4,5,6") if calc.add() == 21: print "10. Success!" else: print "10. Fail!!" calc.expr("1,0") if calc.diff() == 1: print "11. Success!" else: print "11. Fail!!" c = Calculator("3,2,1") if c.diff() == 0: print "12. Success" else: print "12. Fail!!" a = Calculator("5,4,3,2,1") if a.diff() == -5: print "13. Success" else: print "13. Fail!!"