Example #1
0
def test_invalid_to_wei_values(value, unit):
    with pytest.raises(ValueError):
        to_wei(value, unit)

    with pytest.raises(ValueError):
        from_wei(value, unit)
Example #2
0
def test_from_wei(value, expected):
    assert from_wei(*value) == decimal.Decimal(expected)
Example #3
0
def test_conversion_rount_trip(amount_in_wei, intermediate_unit):
    intermediate_amount = from_wei(amount_in_wei, intermediate_unit)
    result_amount = to_wei(intermediate_amount, intermediate_unit)
    assert result_amount == amount_in_wei
Example #4
0
def test_invalid_to_wei_values(value, unit):
    with pytest.raises(ValueError):
        to_wei(value, unit)

    with pytest.raises(ValueError):
        from_wei(value, unit)
Example #5
0
def test_from_wei(value, expected):
    assert from_wei(*value) == decimal.Decimal(expected)
Example #6
0
def test_conversion_rount_trip(amount_in_wei, intermediate_unit):
    intermediate_amount = from_wei(amount_in_wei, intermediate_unit)
    result_amount = to_wei(intermediate_amount, intermediate_unit)
    assert result_amount == amount_in_wei