def testZeroDiscount(self):
     discounted_price = discount_calculator(200, 0, 0 )
     self.assertEqual(discounted_price, 200)
Exemple #2
0
 def testTextAbsolute(self):
     with self.assertRaises(ValueError):
         discounted_price = discount_calculator(20, 10, 'a')
Exemple #3
0
 def testList(self):
     with self.assertRaises(ValueError):
         discounted_price = discount_calculator([1, 2], 10, 25)
Exemple #4
0
 def testNegativeAll(self):
     with self.assertRaises(ValueError):
         discounted_price = discount_calculator(-200, -90, -100)
Exemple #5
0
    def testNormal(self):
        discounted_price = discount_calculator(200, 10, 25)

        # Check that the right values are returned
        self.assertEqual(discounted_price, 155)
Exemple #6
0
 def testTinyResult(self):
     discounted_price = discount_calculator(100, 99, .99)
     self.assertEqual(discounted_price, 0.01)
Exemple #7
0
 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)        
Exemple #15
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 ) 
Exemple #17
0
 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 ) 
Exemple #19
0
 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' )
Exemple #21
0
 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' )   
Exemple #23
0
 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 )                                                                  
Exemple #25
0
 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 ) 
Exemple #27
0
 def testTextAll(self):
     with self.assertRaises(ValueError):
         discounted_price = discount_calculator('a', 'b', 'c')
Exemple #28
0
 def testNormal2(self):
     discounted_price = discount_calculator(200, .10, 25.5)
     self.assertEqual(discounted_price, 154.5)
Exemple #29
0
 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)