From 4a30101618d04831fdf906860f372650fd5b998e Mon Sep 17 00:00:00 2001 From: moanos Date: Thu, 21 Dec 2023 10:30:37 +0100 Subject: [PATCH] feat: Add tests for get_format_from_filename --- tests/__init__.py | 0 tests/test_cli.py | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 tests/__init__.py create mode 100644 tests/test_cli.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_cli.py b/tests/test_cli.py new file mode 100644 index 0000000..068f0e8 --- /dev/null +++ b/tests/test_cli.py @@ -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")