def test_under_50(test_price_under_fifty): test_price_under_fifty.assertEqual( 54.88, coupon_calculations.calculate_order(50, 5, .10)) test_price_under_fifty.assertEqual( 52.50, coupon_calculations.calculate_order(50, 5, .15)) test_price_under_fifty.assertEqual( 50.11, coupon_calculations.calculate_order(50, 5, .20)) test_price_under_fifty.assertEqual( 47.72, coupon_calculations.calculate_order(50, 5, .25)) test_price_under_fifty.assertEqual( 45.34, coupon_calculations.calculate_order(50, 5, .30)) test_price_under_fifty.assertEqual( 50.11, coupon_calculations.calculate_order(50, 10, .10)) test_price_under_fifty.assertEqual( 47.99, coupon_calculations.calculate_order(50, 10, .15)) test_price_under_fifty.assertEqual( 45.87, coupon_calculations.calculate_order(50, 10, .20)) test_price_under_fifty.assertEqual( 43.75, coupon_calculations.calculate_order(50, 10, .25)) test_price_under_fifty.assertEqual( 37.63, coupon_calculations.calculate_order(50, 10, .30))
def test_over_50(test_price_over_fifty): test_price_over_fifty.assertEqual( 64.42, coupon_calculations.calculate_order(60, 5, .10)) test_price_over_fifty.assertEqual( 54.06, coupon_calculations.calculate_order(65, 5, .15)) test_price_over_fifty.assertEqual( 55.12, coupon_calculations.calculate_order(70, 5, .20)) test_price_over_fifty.assertEqual( 59.62, coupon_calculations.calculate_order(80, 5, .25)) test_price_over_fifty.assertEqual( 59.36, coupon_calculations.calculate_order(85, 5, .30)) test_price_over_fifty.assertEqual( 59.65, coupon_calculations.calculate_order(60, 10, .10)) test_price_over_fifty.assertEqual( 58.56, coupon_calculations.calculate_order(75, 10, .15)) test_price_over_fifty.assertEqual( 59.36, coupon_calculations.calculate_order(80, 10, .20)) test_price_over_fifty.assertEqual( 59.62, coupon_calculations.calculate_order(85, 10, .25)) test_price_over_fifty.assertEqual( 59.36, coupon_calculations.calculate_order(90, 10, .30))
def test_under_10(test_price_under_ten): test_price_under_ten.assertEqual( 10.72, coupon_calculations.calculate_order(10, 5, .10)) test_price_under_ten.assertEqual( 10.46, coupon_calculations.calculate_order(10, 5, .15)) test_price_under_ten.assertEqual( 10.19, coupon_calculations.calculate_order(10, 5, .20)) test_price_under_ten.assertEqual( 9.93, coupon_calculations.calculate_order(10, 5, .25)) test_price_under_ten.assertEqual( 9.66, coupon_calculations.calculate_order(10, 5, .30)) test_price_under_ten.assertEqual( 5.95, coupon_calculations.calculate_order(10, 10, .10)) test_price_under_ten.assertEqual( 5.95, coupon_calculations.calculate_order(10, 10, .15)) test_price_under_ten.assertEqual( 5.95, coupon_calculations.calculate_order(10, 10, .20)) test_price_under_ten.assertEqual( 5.95, coupon_calculations.calculate_order(10, 10, .25)) test_price_under_ten.assertEqual( 5.95, coupon_calculations.calculate_order(10, 10, .30))
def test_under_30(test_price_under_thirty): test_price_under_thirty.assertEqual( 31.80, coupon_calculations.calculate_order(30, 5, .10)) test_price_under_thirty.assertEqual( 30.47, coupon_calculations.calculate_order(30, 5, .15)) test_price_under_thirty.assertEqual( 29.15, coupon_calculations.calculate_order(30, 5, .20)) test_price_under_thirty.assertEqual( 27.82, coupon_calculations.calculate_order(30, 5, .25)) test_price_under_thirty.assertEqual( 26.50, coupon_calculations.calculate_order(30, 5, .30)) test_price_under_thirty.assertEqual( 27.03, coupon_calculations.calculate_order(30, 10, .10)) test_price_under_thirty.assertEqual( 25.97, coupon_calculations.calculate_order(30, 10, .15)) test_price_under_thirty.assertEqual( 24.91, coupon_calculations.calculate_order(30, 10, .20)) test_price_under_thirty.assertEqual( 23.85, coupon_calculations.calculate_order(30, 10, .25)) test_price_under_thirty.assertEqual( 22.79, coupon_calculations.calculate_order(30, 10, .30))
def test_price_equal_over_fifty(self): price = 66 self.assertAlmostEqual( 58.194, coupon_calculations.calculate_order(price, 5, 0.1), 2) self.assertAlmostEqual( 54.961, coupon_calculations.calculate_order(price, 5, 0.15), 2) self.assertAlmostEqual( 51.728, coupon_calculations.calculate_order(price, 5, 0.20), 2) self.assertAlmostEqual( 53.424, coupon_calculations.calculate_order(price, 10, 0.1), 2) self.assertAlmostEqual( 50.456, coupon_calculations.calculate_order(price, 10, 0.15), 2) self.assertAlmostEqual( 47.488, coupon_calculations.calculate_order(price, 10, 0.2), 2)
def test_price_under_between_thirty_fifty(self): price = 39 self.assertAlmostEqual( 44.386, coupon_calculations.calculate_order(price, 5, 0.1), 2) self.assertAlmostEqual( 42.584, coupon_calculations.calculate_order(price, 5, 0.15), 2) self.assertAlmostEqual( 40.782, coupon_calculations.calculate_order(price, 5, 0.20), 2) self.assertAlmostEqual( 39.616, coupon_calculations.calculate_order(price, 10, 0.1), 2) self.assertAlmostEqual( 38.079, coupon_calculations.calculate_order(price, 10, 0.15), 2) self.assertAlmostEqual( 36.542, coupon_calculations.calculate_order(price, 10, 0.2), 2)
def test_price_under_between_ten_thirty(self): price = 22 self.assertAlmostEqual( 24.168, coupon_calculations.calculate_order(price, 5, 0.1), 2) self.assertAlmostEqual( 23.267, coupon_calculations.calculate_order(price, 5, 0.15), 2) self.assertAlmostEqual( 22.366, coupon_calculations.calculate_order(price, 5, 0.20), 2) self.assertAlmostEqual( 19.398, coupon_calculations.calculate_order(price, 10, 0.1), 2) self.assertAlmostEqual( 18.762, coupon_calculations.calculate_order(price, 10, 0.15), 2) self.assertAlmostEqual( 18.126, coupon_calculations.calculate_order(price, 10, 0.2), 2)
def test_price_under_ten(self): price = 8 self.assertAlmostEqual( 8.81, coupon_calculations.calculate_order(price, 5, 0.1), 2) self.assertAlmostEqual( 8.65, coupon_calculations.calculate_order(price, 5, 0.15), 2) self.assertAlmostEqual( 8.49, coupon_calculations.calculate_order(price, 5, 0.2), 2) self.assertAlmostEqual( 5.95, coupon_calculations.calculate_order(price, 10, 0.1), 2) self.assertAlmostEqual( 5.95, coupon_calculations.calculate_order(price, 10, 0.15), 2) self.assertAlmostEqual( 5.95, coupon_calculations.calculate_order(price, 10, 0.2), 2)
def test_price_under_over_fifty(self): with mock.patch('builtins.input', side_effect=[50, 5, 10]): assert coupon_calculations.calculate_order() == 52.45
def test_price_under_over_fifty_test_6(self): self.assertEqual(cc.calculate_order(100.00, 10.00, .20), 76.32)
def test_price_under_over_fifty_test_4(self): self.assertEqual(cc.calculate_order(80.00, 10.00, .10), 66.78)
def test_price_under_over_fifty_test_2(self): self.assertEqual(cc.calculate_order(60.00, 5.00, .15), 61.50)
def test_price_under_between_thirty_fifty_test_6(self): self.assertEqual(cc.calculate_order(49.99, 10.00, .20), 45.86)
def test_price_under_between_thirty_fifty_test_4(self): self.assertEqual(cc.calculate_order(35.00, 10.00, .10), 31.80)
def test_price_under_10_test_5(self): self.assertEqual(cc.calculate_order(5, 10.00, .15), 1.45)
def test_price_under_between_thirty_fifty_test_2(self): self.assertEqual(cc.calculate_order(40.00, 5.00, .15), 43.48)
def test_price_under_between_thirty_fifty_test_3(self): self.assertEqual(cc.calculate_order(30.00, 5.00, .20), 29.15)
def test_price_under_10_test_6(self): self.assertEqual(cc.calculate_order(4, 10.00, .20), 0.86)
def test_price_under_between_thirty_fifty_test_5(self): self.assertEqual(cc.calculate_order(30.00, 10.00, .15), 25.97)
def test_price_under_between_ten_thirty_test_1(self): self.assertEqual(cc.calculate_order(29.99, 5.00, .10), 31.79)
def test_price_under_over_fifty_test_1(self): self.assertEqual(cc.calculate_order(50.99, 5.00, .10), 55.82)
def test_price_under_between_ten_thirty_test_2(self): self.assertEqual(cc.calculate_order(20.00, 5.00, .15), 21.46)
def test_price_under_over_fifty_test_3(self): self.assertEqual(cc.calculate_order(70.00, 5.00, .20), 55.12)
def test_price_under_between_ten_thirty_test_4(self): self.assertEqual(cc.calculate_order(29.99, 10.00, .10), 27.02)
def test_price_under_over_fifty_test_5(self): self.assertEqual(cc.calculate_order(90.00, 10.00, .15), 72.08)
def test_price_under_between_ten_thirty_test_5(self): self.assertEqual(cc.calculate_order(15.00, 10.00, .15), 10.46)
def test_price_under_between_ten_thirty(self): with mock.patch('builtins.input', side_effect=[40, 5, 10]): assert coupon_calculations.calculate_order() == 43.45
def test_price_under_between_ten_thirty_test_6(self): self.assertEqual(cc.calculate_order(10.00, 10.00, .20), 5.95)
def test_price_under_ten(self): with mock.patch('builtins.input', side_effect=[10, 5, 10]): assert coupon_calculations.calculate_order() == 10.45
def test_price_under_between_thirty_fifty_test_1(self): self.assertEqual(cc.calculate_order(49.99, 5.00, .10), 54.87)