diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2020-08-16 22:02:04 -0500 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2020-08-16 22:02:04 -0500 |
| commit | 954404e8a111d6445bf9313f0f27c205d88b550f (patch) | |
| tree | 2f91adf21529b401dd9d706019a1d097db8c867e /tests | |
| parent | Use black isort profile (diff) | |
| download | config-file-954404e8a111d6445bf9313f0f27c205d88b550f.zip | |
Enforce `parsed_content` property in AbstractParser
It is used in the ConfigFile object to be able to index
into it.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/conftest.py | 3 | ||||
| -rw-r--r-- | tests/test_abstract_parser.py | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index 3ec303e..6eb351c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,7 +3,6 @@ from typing import Callable, Tuple, Type, Union import pytest -from config_file import ConfigFile from config_file.abstract_parser import AbstractParser from config_file.config_file_path import ConfigFilePath @@ -55,7 +54,7 @@ def template_and_parser( file_type: str, template_name: str = "default" ) -> Tuple[Path, Type[AbstractParser]]: test_file = template_file(file_type, template_name) - return test_file, ConfigFile(test_file)._ConfigFile__parser + return test_file, ConfigFilePath(test_file).parser return func diff --git a/tests/test_abstract_parser.py b/tests/test_abstract_parser.py index 0012127..f52ab45 100644 --- a/tests/test_abstract_parser.py +++ b/tests/test_abstract_parser.py @@ -31,6 +31,9 @@ class ConcreteParser(AbstractParser): def reset_internal_contents(self, file_contents: str) -> None: super().reset_internal_contents(file_contents) + def parsed_content(self) -> dict: + super().parsed_content() + def test_that_abstract_parser_can_not_be_instantiated(): """ @@ -52,6 +55,7 @@ def test_that_abstract_parser_can_not_be_instantiated(): (ConcreteParser("").stringify, None), (ConcreteParser("").has, ("",)), (ConcreteParser("").reset_internal_contents, ("",)), + (ConcreteParser("").parsed_content, None), ], ) def test_that_abstract_parser_raises_not_implemented_errors(function, args): |