From cb605798ab3261754af53f0ee7b96c26c138dd35 Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sun, 10 Jul 2022 19:38:35 +0200 Subject: [PATCH] Update tests --- tests/__init__.py | 0 tests/utilities/data/good.conf | 2 ++ tests/utilities/data/simple.conf | 3 +++ tests/utilities/test_clean.py | 2 +- tests/utilities/test_config_file.py | 6 +++++- 5 files changed, 11 insertions(+), 2 deletions(-) delete mode 100644 tests/__init__.py create mode 100644 tests/utilities/data/simple.conf diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/utilities/data/good.conf b/tests/utilities/data/good.conf index 55336ab..3605c91 100644 --- a/tests/utilities/data/good.conf +++ b/tests/utilities/data/good.conf @@ -4,6 +4,8 @@ first_key= András second_key = test 2 # comment is ignored third_key= "test= 2==" +my_hashtag= "#great_ai" # ferf + fourth_key = " this# is diff --git a/tests/utilities/data/simple.conf b/tests/utilities/data/simple.conf new file mode 100644 index 0000000..924eef7 --- /dev/null +++ b/tests/utilities/data/simple.conf @@ -0,0 +1,3 @@ +# comment +zeroth_key="test" +first_key= András \ No newline at end of file diff --git a/tests/utilities/test_clean.py b/tests/utilities/test_clean.py index 8aa5550..4403997 100644 --- a/tests/utilities/test_clean.py +++ b/tests/utilities/test_clean.py @@ -99,7 +99,7 @@ def test_everything() -> None: """ cleaned = "Hi% 3 >2 my paper there! cost-effective cost - effective cost-effective 1/2/hi 1/2 italic accented text Bei Jing fi ae IJ ij ff Andras oo 2132 rgrv fd" - clean(text, convert_to_ascii=True, remove_brackets=True) == cleaned + assert clean(text, convert_to_ascii=True, remove_brackets=True) == cleaned def test_empty() -> None: diff --git a/tests/utilities/test_config_file.py b/tests/utilities/test_config_file.py index eac0aa2..df6a48b 100644 --- a/tests/utilities/test_config_file.py +++ b/tests/utilities/test_config_file.py @@ -10,6 +10,7 @@ DATA_PATH = Path(__file__).parent.resolve() / "data" def test_simple() -> None: c = ConfigFile(DATA_PATH / "good.conf") assert c.zeroth_key == "test" + assert c.my_hashtag == "#great_ai" assert c.first_key == "András" assert c.second_key == "test 2" assert c.third_key == "test= 2==" @@ -30,6 +31,7 @@ def test_simple_dict() -> None: c = ConfigFile(DATA_PATH / "good.conf") assert c["zeroth_key"] == "test" assert c["first_key"] == "András" + assert c["my_hashtag"] == "#great_ai" assert c["second_key"] == "test 2" assert c["third_key"] == "test= 2==" assert ( @@ -49,6 +51,8 @@ def test_string_path() -> None: c = ConfigFile(str(DATA_PATH / "good.conf")) assert c.zeroth_key == "test" assert c.first_key == "András" + assert c.my_hashtag == "#great_ai" + assert c.second_key == "test 2" assert c.third_key == "test= 2==" assert ( @@ -71,7 +75,7 @@ def test_env() -> None: def test_env_not_exists() -> None: - with pytest.raises(KeyError): + with pytest.raises(ValueError): ConfigFile(DATA_PATH / "env-bad.conf")