aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_utils.py
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2020-01-19 14:57:37 -0600
committerEugene Triguba <eugenetriguba@gmail.com>2020-01-19 14:57:37 -0600
commit7f32dc49460875aedec9e555d0e5d27f23a3f2df (patch)
treef70688edfcf512e3e29fdd7f706391a0f99fb018 /tests/test_utils.py
parentAdd start of json_parser implementaiton (diff)
parentAdd spacing (diff)
downloadconfig-file-7f32dc49460875aedec9e555d0e5d27f23a3f2df.zip
Merge branch 'master' of github.com:eugenetriguba/config_file into json
Diffstat (limited to 'tests/test_utils.py')
-rw-r--r--tests/test_utils.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_utils.py b/tests/test_utils.py
new file mode 100644
index 0000000..6779d18
--- /dev/null
+++ b/tests/test_utils.py
@@ -0,0 +1,19 @@
+import pytest
+
+from config_file.utils import split_on_dot
+
+
+@pytest.mark.parametrize(
+ "test_input, only_last_dot, expected_result",
+ [("section.key.blah", False, ["section", "key", "blah"])],
+)
+def test_that_split_on_dot_splits_the_line_correctly(
+ test_input, only_last_dot, expected_result
+):
+ assert split_on_dot(test_input, only_last_dot=only_last_dot) == expected_result
+
+
+@pytest.mark.parametrize("test_input", ["this line has no dots in it"])
+def test_that_split_on_dot_raises_error_when_there_is_no_dot(test_input):
+ with pytest.raises(ValueError):
+ split_on_dot(test_input)