# mirumee/prices

1 parent eec11cb commit 668acaa490151566b26ec52065564ab5563b3a13 patrys committed Oct 19, 2012
Showing with 13 additions and 13 deletions.
 @@ -3,31 +3,31 @@ Prices: Python price handling for humans :: - >>> from prices import price, pricerange, lineartax - >>> p = price('1.99') - >>> p += price(50) - >>> p += lineartax('1.23', '23% VAT') + >>> from prices import Price, PriceRange, LinearTax + >>> p = Price('1.99') + >>> p += Price(50) + >>> p += LinearTax('0.23', '23% VAT') >>> p.quantize('0.01').gross Decimal('63.95') - >>> pr = pricerange(price(50), price(100)) + >>> pr = PriceRange(Price(50), Price(100)) >>> p in pr True While protecting you from all sorts of mistakes:: - >>> from prices import price - >>> price(10, currency='USD') < price(15, currency='GBP') + >>> from prices import Price + >>> Price(10, currency='USD') < Price(15, currency='GBP') ... ValueError: Cannot compare prices in 'USD' and 'GBP' - >>> price(5, currency='BTC') + price(7, currency='INR') + >>> Price(5, currency='BTC') + Price(7, currency='INR') ... ValueError: Cannot add price in 'BTC' to 'INR' And being helpful:: - >>> from prices import price, lineartax, inspect_price - >>> p = price('1.99') - >>> p += price(50) - >>> p += lineartax('1.23', '23% VAT') + >>> from prices import Price, LinearTax, inspect_price + >>> p = Price('1.99') + >>> p += Price(50) + >>> p += LinearTax('0.23', '23% VAT') >>> inspect_price(p) - "price('1.99', currency=None) + price('50', currency=None) + lineartax('1.23', name='23% VAT')" + "Price('1.99', currency=None) + Price('50', currency=None) + LinearTax('0.23', name='23% VAT')"