Ejemplo n.º 1
0
 def testNonImportedSalesTaxableItemTax(self):
     taxManager = TaxManager()
     itemPrice = Decimal(200)
     itemDescription = "box of chocolate"
     item = Item(ItemOrigin.NON_IMPORTED, ItemType.PERFUME, itemPrice, itemDescription)
     tax = taxManager.calculateTax(item)
     self.assertEqual(tax, Decimal(20.00))
Ejemplo n.º 2
0
 def testImportedNotSalesTaxableItemTax(self):
     taxManager = TaxManager()
     itemPrice = Decimal(20)
     itemDescription = "box of chocolate"
     item = Item(ItemOrigin.IMPORTED, ItemType.FOOD, itemPrice, itemDescription)
     tax = taxManager.calculateTax(item)
     self.assertEqual(tax, Decimal(1))
Ejemplo n.º 3
0
 def testCalculatedTaxIsRoundedToNearestPointFive(self):
     taxManager = TaxManager()
     itemPrice = Decimal(199.4)
     itemDescription = "box of chocolate"
     item = Item(ItemOrigin.NON_IMPORTED, ItemType.PERFUME, itemPrice, itemDescription)
     tax = taxManager.calculateTax(item)
     '''The actual tax on this item 10% of 199.4 which is 19.94, but our algorithm should 
     return 19.95 instead'''
     getcontext().prec = 4
     self.assertEqual(tax, Decimal(19.95))