def test_invalid_to_wei_values(value, unit): with pytest.raises(ValueError): to_wei(value, unit) with pytest.raises(ValueError): from_wei(value, unit)
def test_from_wei(value, expected): assert from_wei(*value) == decimal.Decimal(expected)
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