Update tests

This commit is contained in:
Andras Schmelczer 2022-07-10 19:38:35 +02:00
parent 00568ca6d3
commit cb605798ab
No known key found for this signature in database
GPG key ID: 0EA1BC97D0AB076E
5 changed files with 11 additions and 2 deletions

View file

@ -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

View file

@ -0,0 +1,3 @@
# comment
zeroth_key="test"
first_key= András

View file

@ -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:

View file

@ -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")