Exemple #1
0
 def test_fifty_or_over_test4(self):
     self.assertEqual(
         coupon_calculations.calculate_price(75.00, 10.00, .10), 69.96)
 def test_price_over_50_10_cash_15_percent(self):
     assert round(coupon.calculate_price(75, 10, 15), 2) == 58.57
Exemple #3
0
 def test_price_under_ten(self):  # Test at the low and high sides of the range
     price_under_10_1 = 7.99
     price_under_10_2 = 1.12
     # Tests for the value of price_under_10_1
     self.assertAlmostEqual(coupon_calc.calculate_price(price_under_10_1, 5, 10), 9.16, places=2)
     self.assertAlmostEqual(coupon_calc.calculate_price(price_under_10_1, 5, 15), 9, places=2)
     self.assertAlmostEqual(coupon_calc.calculate_price(price_under_10_1, 5, 20), 8.84, places=2)
     self.assertAlmostEqual(coupon_calc.calculate_price(price_under_10_1, 10, 10), 4.39, places=2)
     self.assertAlmostEqual(coupon_calc.calculate_price(price_under_10_1, 10, 15), 4.5, places=2)
     self.assertAlmostEqual(coupon_calc.calculate_price(price_under_10_1, 10, 20), 4.6, places=2)
     # Tests for the value of price_under_10_2
     self.assertAlmostEqual(coupon_calc.calculate_price(price_under_10_2, 5, 10), 2.61, places=2)
     self.assertAlmostEqual(coupon_calc.calculate_price(price_under_10_2, 5, 15), 2.81, places=2)
     self.assertAlmostEqual(coupon_calc.calculate_price(price_under_10_2, 5, 20), 3.02, places=2)
     self.assertAlmostEqual(coupon_calc.calculate_price(price_under_10_2, 10, 10), -2.16, places=2)
     self.assertAlmostEqual(coupon_calc.calculate_price(price_under_10_2, 10, 15), -1.69, places=2)
     self.assertAlmostEqual(coupon_calc.calculate_price(price_under_10_2, 10, 20), -1.22, places=2)
 def test_price_between_30_and_50_5_cash_20_percent(self):
     assert round(coupon.calculate_price(49.99, 5, 20), 2) == 50.82
 def test_price_over_50_5_cash_15_percent(self):
     assert round(coupon.calculate_price(75, 5, 15), 2) == 63.07
 def test_price_under_10_10_cash_20_percent(self):
     assert round(coupon.calculate_price(14.99, 10, 20), 2) == 10.54
 def test_price_between_10_and_30_10_cash_15_percent(self):
     assert round(coupon.calculate_price(29.99, 10, 15), 2) == 26.44
 def test_price_under_ten_3(self):
     self.assertAlmostEqual(6.31,
                            coupon_calculations.calculate_price(
                                5.00, 5, 0.20),
                            places=2)
 def test_price_under_ten_5(self):
     self.assertAlmostEqual(3.60,
                            coupon_calculations.calculate_price(
                                7.00, 10, 0.15),
                            places=2)
 def test_price_over_fifty_5(self):
     self.assertAlmostEqual(63.07,
                            coupon_calculations.calculate_price(
                                80, 10, .15),
                            places=2)
 def test_price_over_fifty_6(self):
     self.assertAlmostEqual(57.66,
                            coupon_calculations.calculate_price(
                                78, 10, .20),
                            places=2)
 def test_price_over_fifty_4(self):
     self.assertAlmostEqual(64.87,
                            coupon_calculations.calculate_price(
                                78, 10, .10),
                            places=2)
 def test_price_over_fifty_3(self):
     self.assertAlmostEqual(43.25,
                            coupon_calculations.calculate_price(56, 5, .20),
                            places=2)
 def test_price_over_fifty_2(self):
     self.assertAlmostEqual(85.59,
                            coupon_calculations.calculate_price(
                                100, 5, .15),
                            places=2)
 def test_price_under_between_thirty_fifty_5(self):
     self.assertAlmostEqual(41.50,
                            coupon_calculations.calculate_price(
                                42, 10, .15),
                            places=2)
 def test_price_under_ten_6(self):
     self.assertAlmostEqual(3.76,
                            coupon_calculations.calculate_price(
                                7.00, 10, .20),
                            places=2)
 def test_price_under_10_5_cash_15_percent(self):
     assert round(coupon.calculate_price(14.99, 5, 15), 2) == 15.31
 def test_price_under_between_ten_thirty_2(self):
     self.assertAlmostEqual(17.44,
                            coupon_calculations.calculate_price(15, 5, .15),
                            places=2)
 def test_price_between_10_and_30_5_cash_10_percent(self):
     assert round(coupon.calculate_price(29.99, 5, 10), 2) == 32.27
 def test_price_under_ten_1(self):
     self.assertAlmostEqual(8.21,
                            coupon_calculations.calculate_price(
                                7.00, 5, 0.10),
                            places=2)
 def test_price_between_30_and_50_5_cash_15_percent(self):
     assert round(coupon.calculate_price(49.99, 5, 15), 2) == 53.20
 def test_price_under_between_ten_thirty_6(self):
     self.assertAlmostEqual(12.67,
                            coupon_calculations.calculate_price(
                                15, 10, .20),
                            places=2)
 def test_price_between_30_and_50_10_cash_20_percent(self):
     assert round(coupon.calculate_price(49.99, 10, 20), 2) == 46.58
 def test_price_under_between_thirty_fifty_2(self):
     self.assertAlmostEqual(44.20,
                            coupon_calculations.calculate_price(40, 5, .15),
                            places=2)
 def test_price_over_50_5_cash_20_percent(self):
     assert round(coupon.calculate_price(75, 5, 20), 2) == 59.36
 def test_price_under_between_thirty_fifty_3(self):
     self.assertAlmostEqual(34.72,
                            coupon_calculations.calculate_price(31, 5, .20),
                            places=2)
 def test_price_over_50_10_cash_20_percent(self):
     assert round(coupon.calculate_price(75, 10, 20), 2) == 55.12
 def test_price_under_between_thirty_fifty_4(self):
     self.assertAlmostEqual(39.38,
                            coupon_calculations.calculate_price(
                                38, 10, .10),
                            places=2)
Exemple #29
0
 def test_under_10(self):
     assert topic2.calculate_price(5, 5, 0) == 5.95
     assert topic2.calculate_price(7, 5, 20) == 7.65
     assert topic2.calculate_price(9, 2, 20) == 11.89
     assert topic2.calculate_price(8, 5, 15) == 8.65
     assert topic2.calculate_price(9, 0, 0) == 15.49
Exemple #30
0
 def test_fifty_or_over_test3(self):
     self.assertEqual(coupon_calculations.calculate_price(75.00, 5.00, .20),
                      67.31)