aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_abstract_parser.py
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2020-10-03 14:15:46 -0500
committerEugene Triguba <eugenetriguba@gmail.com>2020-10-03 14:15:46 -0500
commit44d781df96d67e5ee301c394677b60bf77d30fce (patch)
tree8714494d580b32405ddb7b9b09da78fcaafc1276 /tests/test_abstract_parser.py
parentAdd docstrings to pytest fixtures (diff)
downloadconfig-file-44d781df96d67e5ee301c394677b60bf77d30fce.zip
Fix issue #25 (INI parser isn't converting back to string)
Diffstat (limited to 'tests/test_abstract_parser.py')
-rw-r--r--tests/test_abstract_parser.py35
1 files changed, 25 insertions, 10 deletions
diff --git a/tests/test_abstract_parser.py b/tests/test_abstract_parser.py
index f52ab45..1a1346a 100644
--- a/tests/test_abstract_parser.py
+++ b/tests/test_abstract_parser.py
@@ -1,9 +1,12 @@
+from typing import Type
+
import pytest
from config_file.abstract_parser import AbstractParser
+from config_file.base_parser import BaseParser
-class ConcreteParser(AbstractParser):
+class ConcreteAbstractParser(AbstractParser):
"""
ConcreteParser is a concrete implementation of the
AbstractParser that just calls the AbstractParser's
@@ -46,23 +49,35 @@ def test_that_abstract_parser_can_not_be_instantiated():
AbstractParser("")
+def test_that_base_parser_can_not_be_instantiated():
+ """
+ config_file.base_parser.BaseParser
+
+ Ensure the BaseParser raises a TypeError when it is
+ instantiated.
+ """
+ with pytest.raises(TypeError):
+ BaseParser("")
+
+
@pytest.mark.parametrize(
"function, args",
[
- (ConcreteParser("").get, ("",)),
- (ConcreteParser("").set, ("", "")),
- (ConcreteParser("").delete, ("",)),
- (ConcreteParser("").stringify, None),
- (ConcreteParser("").has, ("",)),
- (ConcreteParser("").reset_internal_contents, ("",)),
- (ConcreteParser("").parsed_content, None),
+ (ConcreteAbstractParser("").get, ("",)),
+ (ConcreteAbstractParser("").set, ("", "")),
+ (ConcreteAbstractParser("").delete, ("",)),
+ (ConcreteAbstractParser("").stringify, None),
+ (ConcreteAbstractParser("").has, ("",)),
+ (ConcreteAbstractParser("").reset_internal_contents, ("",)),
+ (ConcreteAbstractParser("").parsed_content, None),
],
)
-def test_that_abstract_parser_raises_not_implemented_errors(function, args):
+def test_that_abstract_and_base_parser_raises_not_implemented_errors(function, args):
"""
config_file.abstract_parser.AbstractParser
+ config_file.base_parser.BaseParser
- Ensure the AbstractParser raises a NotImplementedError
+ Ensure the AbstractParser and BaseParser raises a NotImplementedError
for every method in it.
"""
with pytest.raises(NotImplementedError):