From 94e8537430ab7496e4b8e697581d65b06cf8b979 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Mon, 27 May 2019 13:52:20 +0200 Subject: EeVal: Supporting omega symbol in addition to ohm symbol (which are usually graphically equal). --- test/test_EeVal.py | 51 +++++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 24 deletions(-) (limited to 'test') diff --git a/test/test_EeVal.py b/test/test_EeVal.py index 6d4032f..f311aa6 100644 --- a/test/test_EeVal.py +++ b/test/test_EeVal.py @@ -3,31 +3,31 @@ from ee import EeVal @pytest.mark.parametrize("s, num_value, str_value, unit", [ - # ("0", 0, "0", None), - # ("0 k", 0, "0", None), - # ("1", 1, "1", None), - # ("1e-3", 0.001, "1 m", None), - # ("1e3", 1000, "1 k", None), - # ("4.7e3", 4700, "4.7 k", None), + ("0", 0, "0", None), + ("0 k", 0, "0", None), + ("1", 1, "1", None), + ("1e-3", 0.001, "1 m", None), + ("1e3", 1000, "1 k", None), + ("4.7e3", 4700, "4.7 k", None), ("4.e3", 4000, "4 k", 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), + ("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_basic(s, num_value, str_value, unit): num_value = float(num_value) @@ -45,6 +45,9 @@ def test_basic(s, num_value, str_value, unit): ("10n F", "10 nF", "F"), ("10 n F", "10 nF", "F"), ("4.7 n F", "4.7 nF", "F"), + ("10Ω", "10 Ω", "Ω"), + ("10 Ω", "10 Ω", "Ω"), + ("10 Ohm", "10 Ohm", "Ohm"), ]) def test_units(s, str_value, unit): v = EeVal(s) -- cgit v1.2.3