diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2020-08-06 19:03:53 -0500 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2020-08-06 19:03:53 -0500 |
| commit | 286cec0d1c05b6b85f49714ec4635d2e8dcacfc7 (patch) | |
| tree | 24c98af77823cbab22d3463ce01285a809527c1c /tests/test_json_parser.py | |
| parent | Add test for Default util (diff) | |
| download | config-file-286cec0d1c05b6b85f49714ec4635d2e8dcacfc7.zip | |
Remove ini and json parser tests
They heavily overlap with the config_file
test case now and are unnecessary.
Diffstat (limited to 'tests/test_json_parser.py')
| -rw-r--r-- | tests/test_json_parser.py | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/tests/test_json_parser.py b/tests/test_json_parser.py deleted file mode 100644 index 54ea646..0000000 --- a/tests/test_json_parser.py +++ /dev/null @@ -1,109 +0,0 @@ -import pytest - -from config_file.exceptions import ParsingError - - -def test_invalid_json(templated_parser): - with pytest.raises(ParsingError): - templated_parser("json", "invalid") - - -def test_that_json_parser_can_stringify(template_and_parser): - template, parser = template_and_parser("json") - - assert parser.stringify() == template.read_text() - - -@pytest.mark.parametrize( - "key", - [ - "glossary", - "title", - "GlossDiv", - "title", - "GlossList", - "GlossEntry", - "ID", - "GlossTerm", - "Acronym", - "GlossDef", - "para", - "GlossSeeAlso", - "GlossSee", - ], -) -def test_that_json_parser_can_find_wild_keys(key, templated_parser): - parser = templated_parser("json", "glossary") - assert parser.has(key, wild=True) - - -@pytest.mark.parametrize( - "key", - [ - "glossary", - "glossary.title", - "glossary.GlossDiv.GlossList.GlossEntry.GlossDef.para", - ], -) -def test_that_json_parser_can_find_dot_keys(key, templated_parser): - parser = templated_parser("json", "glossary") - assert parser.has(key) - - -@pytest.mark.parametrize( - "value", - [ - "str_value", - "5", - "false", - "Standard Generalized Markup Language", - "ISO 8879:1986", - "A meta-markup language, used to create markup languages such as DocBook.", - "GML", - "XML", - "5.5", - ], -) -def test_that_json_parser_does_not_find_values(value, templated_parser): - parser = templated_parser("json", "glossary") - assert not parser.has(value) - - -@pytest.mark.parametrize( - "key, value", - [ - ("glossary.title", "str_value"), - ("glossary.dict", {"key": "str_value", "str_number": "5"}), - ], -) -def test_that_json_parser_can_get_keys_without_parsing_types( - templated_parser, key, value -): - parser = templated_parser("json", "glossary") - assert parser.get(key) == value - - -@pytest.mark.parametrize( - "key, value", [("zip", "zipzip"), ("foo.bar.foobar", "5"), ("foo.baz", "bar")] -) -def test_that_json_parser_can_set_keys(templated_parser, key, value): - parser = templated_parser("json") - - parser.set(key, value) - assert parser.get(key) == value - - -@pytest.mark.parametrize( - "key", - [ - "glossary", - "glossary.dict_within_dict", - "glossary.GlossDiv.GlossList.GlossEntry.Abbrev", - ], -) -def test_that_json_parser_can_delete_keys(template_and_parser, key): - template, parser = template_and_parser("json", "glossary") - - parser.delete(key) - - assert parser.has(key) is False |