Exemplo n.º 1
0
    def test_rounding_to_currency_precision(self):
        m1 = Money(40000, "USD", 4)

        rounded = m1.round_to(2)

        assert rounded.get_amount() == 400
        assert rounded.precise_amount == 400
        assert rounded.precision == 2
Exemplo n.º 2
0
    def test_lifting_precision(self):
        m1 = Money(400, "USD")

        lifted = m1.round_to(4)

        assert lifted.precise_amount == 40000, "Precise amount {0} is not equal to 40000".format(m1.precise_amount)

        assert lifted == m1, "Currency amount {0} is not equal to 400".format(lifted.get_amount())