aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2020-12-21 22:31:42 -0600
committerEugene Triguba <eugenetriguba@gmail.com>2023-11-05 15:31:22 -0500
commit3f874d1ba218a82ac354af748be73bbbf6e0d985 (patch)
tree132cf9a69e7e4f725ad9366424791e24b0ea7a84 /tests
parentFix readme badge (diff)
downloadconfig-file-3f874d1ba218a82ac354af748be73bbbf6e0d985.zip
Remove depreciated stringify() method
Diffstat (limited to 'tests')
-rw-r--r--tests/test_abstract_parser.py6
-rw-r--r--tests/test_config_file.py10
-rw-r--r--tests/test_config_file_path.py1
-rw-r--r--tests/test_nested_lookup.py7
-rw-r--r--tests/test_toml_parser.py1
-rw-r--r--tests/test_yaml_parser.py1
6 files changed, 7 insertions, 19 deletions
diff --git a/tests/test_abstract_parser.py b/tests/test_abstract_parser.py
index 67469a6..a74d753 100644
--- a/tests/test_abstract_parser.py
+++ b/tests/test_abstract_parser.py
@@ -26,8 +26,8 @@ class ConcreteAbstractParser(AbstractParser):
def has(self, section_key: str, wild: bool = False):
super().has(section_key)
- def stringify(self):
- super().stringify()
+ def __str__(self):
+ super().__str__()
def reset_internal_contents(self, file_contents: str) -> None:
super().reset_internal_contents(file_contents)
@@ -64,7 +64,7 @@ def test_that_base_parser_can_not_be_instantiated():
(ConcreteAbstractParser("").get, ("",)),
(ConcreteAbstractParser("").set, ("", "")),
(ConcreteAbstractParser("").delete, ("",)),
- (ConcreteAbstractParser("").stringify, None),
+ (ConcreteAbstractParser("").__str__, None),
(ConcreteAbstractParser("").has, ("",)),
(ConcreteAbstractParser("").reset_internal_contents, ("",)),
(ConcreteAbstractParser("").parsed_content, None),
diff --git a/tests/test_config_file.py b/tests/test_config_file.py
index 72dbf13..0aea2c8 100644
--- a/tests/test_config_file.py
+++ b/tests/test_config_file.py
@@ -154,7 +154,7 @@ def test_config_file_can_save(template_and_config_file):
config.set("header_one.number_key", 25)
config.save()
- assert config.stringify() == template_file.read_text()
+ assert str(config) == template_file.read_text()
def test_restore_original_can_restore_with_calculated_in_path(
@@ -176,7 +176,7 @@ def test_restore_original_can_restore_with_calculated_in_path(
config.set("header_one.number_key", 5)
config.restore_original()
- assert config.stringify() == original_file.read_text()
+ assert str(config) == original_file.read_text()
assert config.path.read_text() == original_file.read_text()
@@ -201,7 +201,7 @@ def test_restore_original_can_restore_with_passed_in_path(
config.restore_original(original_path=original_file)
- assert config.stringify() == original_config.stringify()
+ assert str(config) == str(original_config)
assert config.path.read_text() == original_file.read_text()
@@ -365,7 +365,7 @@ def test_keys_can_be_set_with_array_notation(template_and_config_file):
config["header_one"] = {}
config.save()
- assert config.stringify() == template_file.read_text()
+ assert str(config) == template_file.read_text()
def test_keys_can_be_retrieved_with_array_notation(templated_config_file):
@@ -397,7 +397,6 @@ def test_the_config_file_can_be_stringified(template_and_config_file):
"""
config_file.config_file.ConfigFile.__str__
config_file.config_file.ConfigFile.__repr__
- config_file.config_file.ConfigFile.stringify()
Ensure that the stringified version of the config file
is the string version of the file and that the repr also
@@ -405,5 +404,4 @@ def test_the_config_file_can_be_stringified(template_and_config_file):
"""
template, config = template_and_config_file()
assert template.read_text() == str(config)
- assert template.read_text() == config.stringify()
assert f"{str(template)}\n\n{str(config)}" == repr(config)
diff --git a/tests/test_config_file_path.py b/tests/test_config_file_path.py
index 41235f8..30b3b7f 100644
--- a/tests/test_config_file_path.py
+++ b/tests/test_config_file_path.py
@@ -1,4 +1,3 @@
-import os
from pathlib import Path
import pytest
diff --git a/tests/test_nested_lookup.py b/tests/test_nested_lookup.py
index 1239fad..1dd274a 100644
--- a/tests/test_nested_lookup.py
+++ b/tests/test_nested_lookup.py
@@ -856,7 +856,6 @@ class TestNestedUpdate(BaseLookUpApi):
class TestNestedAlter(BaseLookUpApi):
def test_nested_alter_in_place_true(self):
-
# callback functions
def callback(data):
return str(data) + "###"
@@ -870,7 +869,6 @@ class TestNestedAlter(BaseLookUpApi):
self.assertEqual(vorgangsid, "1###")
def test_nested_alter_in_place_false(self):
-
# callback functions
def callback(data):
return str(data) + "###"
@@ -886,7 +884,6 @@ class TestNestedAlter(BaseLookUpApi):
self.assertEqual(vorgangsid, "1###")
def test_nested_alter_list_input_in_place_true(self):
-
# callback functions
def callback(data):
return str(data) + "###"
@@ -906,7 +903,6 @@ class TestNestedAlter(BaseLookUpApi):
self.assertEqual(vorgangsid, "1###")
def test_nested_alter_list_input_with_args_in_place_true(self):
-
# callback functions
def callback(data, str1, str2):
return str(data) + str1 + str2
@@ -930,7 +926,6 @@ class TestNestedAlter(BaseLookUpApi):
self.assertEqual(vorgangsid, "1abcdef")
def test_nested_alter_list_input_with_args_in_place_false(self):
-
# callback functions
def callback(data, str1, str2):
return str(data) + str1 + str2
@@ -954,7 +949,6 @@ class TestNestedAlter(BaseLookUpApi):
self.assertEqual(vorgangsid, "1abcdef")
def test_nested_alter_list_input_in_place_false(self):
-
# callback functions
def callback(data):
return str(data) + "###"
@@ -1010,7 +1004,6 @@ class TestNestedAlter(BaseLookUpApi):
self.assertEqual(altered_document["key"], 150)
def test_sample_data4(self):
-
result = {
"modelversion": "1.1.0",
"vorgangsID": "1",
diff --git a/tests/test_toml_parser.py b/tests/test_toml_parser.py
index 7fc7d4e..8c6a905 100644
--- a/tests/test_toml_parser.py
+++ b/tests/test_toml_parser.py
@@ -13,7 +13,6 @@ def test_that_import_error_is_raised_if_no_tomlkit():
installed.
"""
with pytest.raises(ImportError) as error:
-
with patch("builtins.__import__") as mock_import:
mock_import.side_effect = ImportError
TomlParser("")
diff --git a/tests/test_yaml_parser.py b/tests/test_yaml_parser.py
index e375dd9..cb25f4d 100644
--- a/tests/test_yaml_parser.py
+++ b/tests/test_yaml_parser.py
@@ -13,7 +13,6 @@ def test_that_import_error_is_raised_if_no_ruamelyaml():
installed.
"""
with pytest.raises(ImportError) as error:
-
with patch("builtins.__import__") as mock_import:
mock_import.side_effect = ImportError
YamlParser("")