예제 #1
0
 def testErrorNumberNegative(self):
     with self.assertRaisesRegex(Exception, "Sorry, il numero è negativo"):
         object1 = Money(5)
         object2 = Money(10)
         n = object1.subtraction(object2)
     with self.assertRaisesRegex(
             Exception,
             "Sorry, il numero inserito non può essere negativo"):
         num = Money(-10)
예제 #2
0
 def testSubtraction(self):
     object1 = Money(10)
     object2 = Money(5)
     n = object1.subtraction(object2)
     self.assertIsInstance(n, Money)
     self.assertEqual(5, n.getNumber())