Ejemplo n.º 1
0
    def test_round(self):
        "Test rounding."

        w = Wallet(CAD='17.1343843', USD='83.42434', EUR='6.237237232')
        mprecision = dict((('USD', Decimal('.01')),
                           ('EUR', Decimal('.0001')),
                           ('JPY', Decimal('.00001')),
                           (None, Decimal('.1')),
                           ))
        wr = w.round(mprecision)
        assert wr['EUR'] == Decimal('6.2372')
        assert wr['USD'] == Decimal('83.42')
        assert wr['CAD'] == Decimal('17.10')