feat: Add tests for get_format_from_filename

This commit is contained in:
moanos [he/him] 2023-12-21 10:30:37 +01:00
parent 9eeaed3b14
commit 4a30101618
2 changed files with 21 additions and 0 deletions

0
tests/__init__.py Normal file
View File

21
tests/test_cli.py Normal file
View File

@ -0,0 +1,21 @@
from fediverse_blocklist_tool.cli import get_format_from_filename
def test_get_format_from_filename():
assert "toml" == get_format_from_filename("temp.toml")
assert "csv" == get_format_from_filename("temp.csv")
assert "json" == get_format_from_filename("temp.json")
assert "md" == get_format_from_filename("temp.md")
assert "md" == get_format_from_filename("csv.md")
assert "md" == get_format_from_filename("toml.md")
assert "md" == get_format_from_filename("json.md")
assert "toml" == get_format_from_filename("csv.toml")
assert "toml" == get_format_from_filename("md.toml")
assert "toml" == get_format_from_filename("json.toml")
assert "toml" == get_format_from_filename("tmp")
assert "json" == get_format_from_filename("csv.json")
assert "json" == get_format_from_filename("md.json")
assert "json" == get_format_from_filename("toml.json")