Exemplo n.º 1
0
    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())
Exemplo n.º 2
0
    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())
Exemplo n.º 3
0
    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())
Exemplo n.º 4
0
    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())
Exemplo n.º 5
0
    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())
Exemplo n.º 6
0
    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())
Exemplo n.º 7
0
 def test_order_free(self):
     order = Order('13 book at 14.99')
     self.assertEqual(Decimal('0.00'), order.tax())