From 1335bef6c3d0329678b2680dfc7435ad11db25df Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Fri, 22 Sep 2017 08:23:51 +0200 Subject: o EeVal: implememting unit parsing too. --- test/test_formatting.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test') diff --git a/test/test_formatting.py b/test/test_formatting.py index 88fb8ed..6687e96 100644 --- a/test/test_formatting.py +++ b/test/test_formatting.py @@ -87,3 +87,14 @@ def test_EeVal(s, num_value, str_value, unit): assert (num_value + epsilon) >= float(v) and (num_value - epsilon) <= float(v) assert str_value == str(v) assert unit == v.unit + +@pytest.mark.parametrize("s, str_value, unit", [ + ("10nF", "10 nF", "F"), + ("10n F", "10 nF", "F"), + ("10 n F", "10 nF", "F"), + ]) +def test_EeVal_with_units(s, str_value, unit): + v = EeVal(s) + assert unit == v.unit + assert float(v) == v.value + assert str_value == str(v) -- cgit v1.2.3