Ejemplo n.º 1
0
 def test_vat_rate_to_decimal(self):
     assert UnitConverter.vat_rate_to_decimal(2500) == Decimal('0.25')
Ejemplo n.º 2
0
 def test_to_decimals_fraction(self):
     result = UnitConverter.to_decimals(9)
     expected = Decimal("0.09")
     assert result == expected
Ejemplo n.º 3
0
 def test_to_decimals_zero(self):
     result = UnitConverter.to_decimals(0)
     expected = Decimal("0.00")
     assert result == expected
Ejemplo n.º 4
0
 def test_vat_rate_to_minor_units_rounding(self):
     assert UnitConverter.vat_rate_to_minor_units(
         Decimal("0.06555555")) == 656
Ejemplo n.º 5
0
 def test_to_decimals_success(self):
     result = UnitConverter.to_decimals(1210)
     expected = Decimal("12.10")
     assert result == expected
Ejemplo n.º 6
0
 def test_vat_rate_to_minor_units(self):
     assert UnitConverter.vat_rate_to_minor_units(Decimal("0.06")) == 600
Ejemplo n.º 7
0
 def test_to_minor_units_from_float_assertion_error(self):
     with pytest.raises(TypeError):
         UnitConverter.to_minor_units(12.1)
Ejemplo n.º 8
0
 def test_to_minor_units_round_down(self):
     result = UnitConverter.to_minor_units(Decimal("0.011"))
     expected = 1
     assert result == expected
Ejemplo n.º 9
0
 def test_to_minor_units_round_up(self):
     result = UnitConverter.to_minor_units(Decimal("0.095"))
     expected = 10
     assert result == expected
Ejemplo n.º 10
0
 def test_to_minor_units(self):
     result = UnitConverter.to_minor_units(Decimal("12.10"))
     expected = 1210
     assert result == expected