aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2020-11-26 13:18:44 -0600
committerEugene Triguba <eugenetriguba@gmail.com>2020-11-26 13:18:44 -0600
commitd6832cd600a28c1396c67229245347c1cf9440ca (patch)
treee216eed48e9130be1bd63d4ad0ee3c8cad68d915 /tests
parentAdd python 3.9 to pyproject and update lockfile (diff)
downloadconfig-file-d6832cd600a28c1396c67229245347c1cf9440ca.zip
Move parsers to parsers directory
Diffstat (limited to 'tests')
-rw-r--r--tests/conftest.py12
-rw-r--r--tests/test_abstract_parser.py6
-rw-r--r--tests/test_base_parser.py0
-rw-r--r--tests/test_config_file.py8
-rw-r--r--tests/test_config_file_path.py8
-rw-r--r--tests/test_parse_value.py2
-rw-r--r--tests/test_toml_parser.py2
-rw-r--r--tests/test_yaml_parser.py2
8 files changed, 19 insertions, 21 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index 075d356..9392368 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -3,8 +3,8 @@ from typing import Callable, Tuple, Type, Union
import pytest
-from config_file.abstract_parser import AbstractParser
from config_file.config_file_path import ConfigFilePath
+from config_file.parsers.abstract_parser import AbstractParser
@pytest.fixture
@@ -42,7 +42,7 @@ def template_file(tmp_file: Callable[[str, str], Path]) -> Callable[[str, str],
template_name: The name of the template to retrieve.
Defaults to the "default" template. i.e. the template
with the name "default" with it's respective file extension.
-
+
Returns:
A Path object point to that test template.
"""
@@ -69,7 +69,7 @@ def template_original_file() -> Callable[[Path], Path]:
Args:
template_path: The path to the temporary template file we're using.
-
+
Returns:
A Path object pointing to the newly created original template file.
"""
@@ -99,9 +99,9 @@ def template_and_parser(
file_type: The parser type to retrieve i.e. "ini" -> IniParser
template_name: The template to retrieve. Defaults to the
"default" template file for each extension.
-
+
Returns:
- The template and parser corresponding to the file_type with
+ The template and parser corresponding to the file_type with
the template file read in.
"""
@@ -125,7 +125,7 @@ def templated_parser(template_and_parser) -> Callable[[str, str], Type[AbstractP
file_type: The parser type to retrieve i.e. "ini" -> IniParser
template_name: The template to retrieve. Defaults to the
"default" template file for each extension.
-
+
Returns:
The parser corresponding to the file_type with the template file
read in.
diff --git a/tests/test_abstract_parser.py b/tests/test_abstract_parser.py
index 1a1346a..67469a6 100644
--- a/tests/test_abstract_parser.py
+++ b/tests/test_abstract_parser.py
@@ -1,9 +1,7 @@
-from typing import Type
-
import pytest
-from config_file.abstract_parser import AbstractParser
-from config_file.base_parser import BaseParser
+from config_file.parsers.abstract_parser import AbstractParser
+from config_file.parsers.base_parser import BaseParser
class ConcreteAbstractParser(AbstractParser):
diff --git a/tests/test_base_parser.py b/tests/test_base_parser.py
deleted file mode 100644
index e69de29..0000000
--- a/tests/test_base_parser.py
+++ /dev/null
diff --git a/tests/test_config_file.py b/tests/test_config_file.py
index 74e4dd3..72dbf13 100644
--- a/tests/test_config_file.py
+++ b/tests/test_config_file.py
@@ -4,11 +4,11 @@ from typing import Callable, Tuple
import pytest
-from config_file.abstract_parser import AbstractParser
from config_file.config_file import ConfigFile
-from config_file.exceptions import ParsingError
-from config_file.ini_parser import IniParser
from config_file.config_file_path import ConfigFilePath
+from config_file.exceptions import ParsingError
+from config_file.parsers.abstract_parser import AbstractParser
+from config_file.parsers.ini_parser import IniParser
SUPPORTED_FILE_TYPES = ["ini", "json", "yaml", "toml"]
@@ -125,7 +125,7 @@ def test_set_can_add_to_or_alter_the_file(templated_config_file, key, value):
"""
config_file.config_file.ConfigFile.set
- Ensure that for the keys we can, we retrieve that same value back
+ Ensure that for the keys we can, we retrieve that same value back
(with the exception of ini, which should always be a string).
"""
config = templated_config_file()
diff --git a/tests/test_config_file_path.py b/tests/test_config_file_path.py
index 3bb7215..6b4dd93 100644
--- a/tests/test_config_file_path.py
+++ b/tests/test_config_file_path.py
@@ -4,10 +4,10 @@ from pathlib import Path, _posix_flavour, _windows_flavour
import pytest
from config_file.config_file_path import ConfigFilePath
-from config_file.ini_parser import IniParser
-from config_file.json_parser import JsonParser
-from config_file.toml_parser import TomlParser
-from config_file.yaml_parser import YamlParser
+from config_file.parsers.ini_parser import IniParser
+from config_file.parsers.json_parser import JsonParser
+from config_file.parsers.toml_parser import TomlParser
+from config_file.parsers.yaml_parser import YamlParser
def test_config_file_path_is_a_path():
diff --git a/tests/test_parse_value.py b/tests/test_parse_value.py
index 7956a06..4845f76 100644
--- a/tests/test_parse_value.py
+++ b/tests/test_parse_value.py
@@ -2,7 +2,7 @@ from datetime import datetime
import pytest
-from config_file.parse_value import (
+from config_file.parsers.parse_value import (
can_be_parsed_as_bool,
can_be_parsed_as_dict,
can_be_parsed_as_float,
diff --git a/tests/test_toml_parser.py b/tests/test_toml_parser.py
index 845e78e..7fc7d4e 100644
--- a/tests/test_toml_parser.py
+++ b/tests/test_toml_parser.py
@@ -2,7 +2,7 @@ from unittest.mock import patch
import pytest
-from config_file.toml_parser import TomlParser
+from config_file.parsers.toml_parser import TomlParser
def test_that_import_error_is_raised_if_no_tomlkit():
diff --git a/tests/test_yaml_parser.py b/tests/test_yaml_parser.py
index 1f46692..e375dd9 100644
--- a/tests/test_yaml_parser.py
+++ b/tests/test_yaml_parser.py
@@ -2,7 +2,7 @@ from unittest.mock import patch
import pytest
-from config_file.yaml_parser import YamlParser
+from config_file.parsers.yaml_parser import YamlParser
def test_that_import_error_is_raised_if_no_ruamelyaml():