def test_order_taxes(self): order = Order('13 music CD at 14.99') price = Decimal('14.99') tax = rounding_rule(price * Decimal('0.1')) self.assertEqual(tax, order.tax()) self.assertEqual(price + tax, order.taxed_price())
def test_order_imported_and_taxed(self): order = Order('1 imported bottle of perfume at 10.00') price = Decimal('10.00') tax = rounding_rule(price*Decimal('0.05') + price*Decimal('0.10')) self.assertEqual(tax, order.tax())
def test_rounding_rule(self): self.assertEqual(Decimal('1.00'), rounding_rule(Decimal('1.00'))) self.assertEqual(Decimal('1.05'), rounding_rule(Decimal('1.01'))) self.assertEqual(Decimal('1.10'), rounding_rule(Decimal('1.06')))
def test_order_free_imported(self): order = Order('13 imported book at 10.00') price = Decimal('10.00') tax = rounding_rule(price * Decimal('0.05')) self.assertEqual(tax, order.tax())