Beispiel #1
0
def test_kg_in_oz():
    kg_oz = UnitInterface(display_unit=DisplayUnit(
        internal_unit=get_kilogram_sales_unit(decimals=9),
        ratio=Decimal('0.028349523'),
        decimals=3, symbol='oz'))
    assert kg_oz.comparison_quantity == Decimal('0.028349523')
    assert kg_oz.render_quantity('0.028349523') == '1.000oz'
    assert kg_oz.render_quantity(1) == '35.274oz'
    assert kg_oz.render_quantity(0.001) == '0.035oz'
    assert kg_oz.from_display(Decimal('0.001')) == Decimal('0.000028350')
    assert kg_oz.to_display(Decimal('0.000028350')) == approx('0.001')
def test_kg_in_oz():
    kg_oz = UnitInterface(display_unit=DisplayUnit(
        internal_unit=get_kilogram_sales_unit(decimals=9),
        ratio=Decimal('0.028349523'),
        decimals=3, symbol='oz'))
    assert kg_oz.comparison_quantity == Decimal('0.028349523')
    assert kg_oz.render_quantity('0.028349523') == '1.000oz'
    assert kg_oz.render_quantity(1) == '35.274oz'
    assert kg_oz.render_quantity(0.001) == '0.035oz'
    assert kg_oz.from_display(Decimal('0.001')) == Decimal('0.000028350')
    assert kg_oz.to_display(Decimal('0.000028350')) == approx('0.001')
Beispiel #3
0
def test_kg_in_oz():
    kg_oz = UnitInterface(
        display_unit=DisplayUnit(
            internal_unit=get_kilogram_sales_unit(decimals=9), ratio=Decimal("0.028349523"), decimals=3, symbol="oz"
        )
    )
    assert kg_oz.comparison_quantity == Decimal("0.028349523")
    assert kg_oz.render_quantity("0.028349523") == "1.000oz"
    assert kg_oz.render_quantity(1) == "35.274oz"
    assert kg_oz.render_quantity(0.001) == "0.035oz"
    assert kg_oz.from_display(Decimal("0.001")) == Decimal("0.000028350")
    assert kg_oz.to_display(Decimal("0.000028350")) == approx("0.001")