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_tax_check(self): order = Order('13 music CD at 14.99') self.assertTrue(order.is_taxed()) order = Order('13 book at 14.99') self.assertFalse(order.is_taxed()) order = Order('13 medical at 14.99') self.assertFalse(order.is_taxed())
def test_parse_order(self): order = Order('13 music CD at 14.99') self.assertEqual(13, order.quantity()) self.assertEqual('music CD', order.description()) self.assertEqual(Decimal('14.99'), order.price())
def test_order_import_check(self): order = Order('13 music CD at 14.99') self.assertFalse(order.is_imported()) order = Order('1 imported box of chocolates at 10.00') self.assertTrue(order.is_imported())
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_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())
def test_order_free(self): order = Order('13 book at 14.99') self.assertEqual(Decimal('0.00'), order.tax())