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)
def testSubtraction(self): object1 = Money(10) object2 = Money(5) n = object1.subtraction(object2) self.assertIsInstance(n, Money) self.assertEqual(5, n.getNumber())