def testZeroDiscount(self): discounted_price = discount_calculator(200, 0, 0 ) self.assertEqual(discounted_price, 200)
def testTextAbsolute(self): with self.assertRaises(ValueError): discounted_price = discount_calculator(20, 10, 'a')
def testList(self): with self.assertRaises(ValueError): discounted_price = discount_calculator([1, 2], 10, 25)
def testNegativeAll(self): with self.assertRaises(ValueError): discounted_price = discount_calculator(-200, -90, -100)
def testNormal(self): discounted_price = discount_calculator(200, 10, 25) # Check that the right values are returned self.assertEqual(discounted_price, 155)
def testTinyResult(self): discounted_price = discount_calculator(100, 99, .99) self.assertEqual(discounted_price, 0.01)
def testNegativePrice(self): with self.assertRaises(ValueError): discounted_price = discount_calculator(-200, 10, 25)
def testNormal(self): discounted_price = discount_calculator(200, 10, 25 ) # Check that the right values are returned self.assertEqual(discounted_price, 155)
def testNegativeAll(self): with self.assertRaises(ValueError): discounted_price = discount_calculator(-200, -90, -100 )
def testNegativePrice(self): with self.assertRaises(ValueError): discounted_price = discount_calculator(-200, 10, 25 )
def testNegativeAbsolute(self): with self.assertRaises(ValueError): discounted_price = discount_calculator(200, 10, -25 )
def testTinyDiscount(self): discounted_price = discount_calculator(200, 1, .01 ) self.assertEqual(discounted_price, 197.99)
def testTinyResult(self): discounted_price = discount_calculator(100, 99, .99 ) self.assertEqual(discounted_price, 0.01)
def testNegativeResult3(self): discounted_price = discount_calculator(200, 90, 1000 ) self.assertEqual(discounted_price, 0)
def testZeroDiscount(self): discounted_price = discount_calculator(200, 0, 0) self.assertEqual(discounted_price, 200)
def testTextPrice(self): with self.assertRaises(ValueError): discounted_price = discount_calculator('a', 10, 25 )
def testNegativeResult3(self): discounted_price = discount_calculator(200, 90, 1000) self.assertEqual(discounted_price, 0)
def testTextRelative(self): with self.assertRaises(ValueError): discounted_price = discount_calculator(20, 'a', 25 )
def testTinyDiscount(self): discounted_price = discount_calculator(200, 1, .01) self.assertEqual(discounted_price, 197.99)
def testTextAbsolute(self): with self.assertRaises(ValueError): discounted_price = discount_calculator(20, 10, 'a' )
def testNegativeAbsolute(self): with self.assertRaises(ValueError): discounted_price = discount_calculator(200, 10, -25)
def testTextAll(self): with self.assertRaises(ValueError): discounted_price = discount_calculator('a', 'b', 'c' )
def testTextPrice(self): with self.assertRaises(ValueError): discounted_price = discount_calculator('a', 10, 25)
def testList(self): with self.assertRaises(ValueError): discounted_price = discount_calculator([1, 2], 10, 25 )
def testTextRelative(self): with self.assertRaises(ValueError): discounted_price = discount_calculator(20, 'a', 25)
def testDict(self): with self.assertRaises(ValueError): discounted_price = discount_calculator({'a': 200}, 10, 25 )
def testTextAll(self): with self.assertRaises(ValueError): discounted_price = discount_calculator('a', 'b', 'c')
def testNormal2(self): discounted_price = discount_calculator(200, .10, 25.5) self.assertEqual(discounted_price, 154.5)
def testDict(self): with self.assertRaises(ValueError): discounted_price = discount_calculator({'a': 200}, 10, 25)
def testNormal2(self): discounted_price = discount_calculator(200, .10, 25.5 ) self.assertEqual(discounted_price, 154.5)