aboutsummaryrefslogtreecommitdiff
path: root/test/test_formatting.py
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2017-08-02 22:51:34 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2017-08-02 22:51:34 +0200
commitc2d21a4c36cf9374b708f580af2fd420bb9b1146 (patch)
treeab04461cb233384f7523d59282968f26615c62bd /test/test_formatting.py
parent2384a4e12cb029cbd6c8595fa9f3c5a666a391da (diff)
downloadee-python-c2d21a4c36cf9374b708f580af2fd420bb9b1146.tar.gz
ee-python-c2d21a4c36cf9374b708f580af2fd420bb9b1146.tar.bz2
ee-python-c2d21a4c36cf9374b708f580af2fd420bb9b1146.tar.xz
ee-python-c2d21a4c36cf9374b708f580af2fd420bb9b1146.zip
o Indenting with two spaces.
o Reworking test to use pytest's parametrize
Diffstat (limited to 'test/test_formatting.py')
-rw-r--r--test/test_formatting.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/test_formatting.py b/test/test_formatting.py
new file mode 100644
index 0000000..560daee
--- /dev/null
+++ b/test/test_formatting.py
@@ -0,0 +1,38 @@
+import pytest
+from ee.formatting import eng_str
+
+@pytest.mark.parametrize("input,expected", [
+ (5.5, "5.5"),
+ (55, "55"),
+ (550, "550"),
+ (5500, "5.5 k"),
+ (55000, "55 k"),
+ (550000, "550 k"),
+ (5500000, "5.5 M"),
+ ])
+def test_eng_str(input, expected):
+ assert eng_str(input) == expected
+
+@pytest.mark.parametrize("input,expected", [
+ (100, ''), (101, ''), (102, ''), (103, ''), (104, ''), (105, ''), (106, ''), (107, ''), (108, ''), (109, ''),
+ (110, ''), (111, ''), (112, ''), (113, ''), (114, ''), (115, ''), (116, ''), (117, ''), (118, ''), (119, ''),
+ (120, ''), (121, ''), (122, ''), (123, ''), (124, ''), (125, ''), (126, ''), (127, ''), (128, ''), (129, ''),
+ (130, ''), (131, ''), (132, ''), (133, ''), (134, ''), (135, ''), (136, ''), (137, ''), (138, ''), (139, ''),
+ ])
+def xx_test_eng_str2(input, expected):
+ assert eng_str(input) == expected
+
+@pytest.mark.parametrize("input,expected", [
+ (10, '10'),
+ (11, '11'),
+ (12, '12'),
+ (13, '13'),
+ (14, '14'),
+ (15, '15'),
+ (16, '16'),
+ (17, '17'),
+ (18, '18'),
+ (19, '19'),
+ ])
+def xx_test_eng_str3(input, expected):
+ assert eng_str(input) == expected