diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2020-08-06 09:47:35 -0500 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2020-08-06 09:47:35 -0500 |
| commit | 836cefe45633331d0e5692295174bf3181a5e365 (patch) | |
| tree | 8602b312e67cc591f33022f56221ca7434cfe33f /tests | |
| parent | Update README example to remove MissingKeyError (diff) | |
| download | config-file-836cefe45633331d0e5692295174bf3181a5e365.zip | |
Change MissingKeyErrors to KeyError
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_abstract_parser.py | 4 | ||||
| -rw-r--r-- | tests/test_config_file.py | 5 | ||||
| -rw-r--r-- | tests/test_ini_parser.py | 6 |
3 files changed, 7 insertions, 8 deletions
diff --git a/tests/test_abstract_parser.py b/tests/test_abstract_parser.py index a2d9dbe..1816f6b 100644 --- a/tests/test_abstract_parser.py +++ b/tests/test_abstract_parser.py @@ -34,7 +34,7 @@ class ConcreteParser(AbstractParser): def test_that_abstract_parser_can_not_be_instantiated(): """ - config_file.abstract_parser.abstract_parser + config_file.abstract_parser.AbstractParser Ensure the AbstractParser raises a TypeError when it is instantiated. @@ -56,7 +56,7 @@ def test_that_abstract_parser_can_not_be_instantiated(): ) def test_that_abstract_parser_raises_not_implemented_errors(function, args): """ - config_file.abstract_parser.abstract_parser + config_file.abstract_parser.AbstractParser Ensure the AbstractParser raises a NotImplementedError for every method in it. diff --git a/tests/test_config_file.py b/tests/test_config_file.py index 7e21e0b..023b6ae 100644 --- a/tests/test_config_file.py +++ b/tests/test_config_file.py @@ -4,7 +4,6 @@ import pytest from config_file.abstract_parser import AbstractParser from config_file.config_file import ConfigFile -from config_file.exceptions import MissingKeyError from config_file.ini_parser import IniParser SUPPORTED_FILE_TYPES = ["ini", "json", "yaml", "toml"] @@ -126,10 +125,10 @@ def test_that_config_file_can_delete(templated_config_file, key): @pytest.mark.parametrize("key", ["", 0, False, {}, "header_one.does_not_exist"]) -def test_that_config_file_raises_missing_key_error_on_invalid_input_or_missing_key( +def test_that_config_file_raises_key_error_on_invalid_input_or_missing_key( templated_config_file, key ): config = templated_config_file() - with pytest.raises(MissingKeyError): + with pytest.raises(KeyError): config.delete(key) diff --git a/tests/test_ini_parser.py b/tests/test_ini_parser.py index 24507b7..2accc8f 100644 --- a/tests/test_ini_parser.py +++ b/tests/test_ini_parser.py @@ -1,6 +1,6 @@ import pytest -from config_file.exceptions import MissingKeyError, ParsingError +from config_file.exceptions import ParsingError from config_file.ini_parser import IniParser @@ -81,10 +81,10 @@ def test_that_ini_parser_can_delete(section_key, expected_result): @pytest.mark.parametrize( "section_key", ["section_is_not_present", "test_section.but_key_is_not_present"], ) -def test_that_ini_parser_delete_raises_missing_key_errors(section_key): +def test_that_ini_parser_delete_raises_key_error(section_key): ini_file = """[test_section]\nkey1 = value\n\n""" parser = IniParser(ini_file) - with pytest.raises(MissingKeyError): + with pytest.raises(KeyError): parser.delete(section_key) |