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

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