Update tests
This commit is contained in:
parent
00568ca6d3
commit
cb605798ab
5 changed files with 11 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
3
tests/utilities/data/simple.conf
Normal file
3
tests/utilities/data/simple.conf
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# comment
|
||||
zeroth_key="test"
|
||||
first_key= András
|
||||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue