aboutsummaryrefslogtreecommitdiff
path: root/test/test_formatting.py
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2017-12-15 00:41:37 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2017-12-15 07:30:35 +0100
commitf9a16187f3b4fda0790c34997ca24db749ddf86d (patch)
treec8a72ba12cca9b8aa6e23468722efd5ad80f9e01 /test/test_formatting.py
parentb0e35cb9a8717708240155820c5e013b61e52534 (diff)
downloadee-python-f9a16187f3b4fda0790c34997ca24db749ddf86d.tar.gz
ee-python-f9a16187f3b4fda0790c34997ca24db749ddf86d.tar.bz2
ee-python-f9a16187f3b4fda0790c34997ca24db749ddf86d.tar.xz
ee-python-f9a16187f3b4fda0790c34997ca24db749ddf86d.zip
o Fixing an EeVal parsing bug of '0 Ohms'.
o Moving EeVal tests to it's main test file.
Diffstat (limited to 'test/test_formatting.py')
-rw-r--r--test/test_formatting.py43
1 files changed, 0 insertions, 43 deletions
diff --git a/test/test_formatting.py b/test/test_formatting.py
index bcb9300..4b5d1fe 100644
--- a/test/test_formatting.py
+++ b/test/test_formatting.py
@@ -61,46 +61,3 @@ def xx_test_eng_str2(input, expected):
])
def xx_test_eng_str3(input, expected):
assert expected == eng_str(input)
-
-
-@pytest.mark.parametrize("s, num_value, str_value, unit", [
- ("1", 1, "1", None),
- ("10", 10, "10", None),
- ("10k", 10 * 1000, "10 k", None),
- ("10 k", 10 * 1000, "10 k", None),
- ("10 k", 10 * 1000, "10 k", None),
- ("1000 m", 1, "1", None),
- ("100 m", 0.1, "100 m", None),
- ("100 n", 0.0000001, "100 n", None),
- ("1 m", 0.001, "1 m", None),
- ("1 u", 0.000001, "1 u", None),
- ("0.1 u", 0.0000001, "100 n", None),
- (".1 u", 0.0000001, "100 n", None),
- ("4.7 u", 0.0000047, "4.7 u", None),
- ("1 µ", 0.000001, "1 u", None),
- ("1 n", 0.000000001, "1 n", None),
- ("10 n", 0.00000001, "10 n", None),
- ("1p", 1e-12, "1 p", None),
- ("0.8p", 8e-13, "0.8 p", None),
- ("0.008p", 8e-15, "0.008 p", None),
- ])
-def test_EeVal(s, num_value, str_value, unit):
- num_value = float(num_value)
- v = EeVal(s)
- assert float(v) == v.value
- epsilon = num_value * 0.01
- 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"),
- ("4.7 n F", "4.7 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)