From 0cf191b2efcbc5619eb226d90431e4d6022cde65 Mon Sep 17 00:00:00 2001 From: klinga Date: Sun, 17 Mar 2024 23:01:16 -0400 Subject: [PATCH] renamed module --- tests/test_utils.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/test_utils.py diff --git a/tests/test_utils.py b/tests/test_utils.py new file mode 100644 index 0000000..e77c0a5 --- /dev/null +++ b/tests/test_utils.py @@ -0,0 +1,24 @@ +import pytest + + +from google_books.utils import fh_date + + +@pytest.mark.parametrize( + "arg,expectation", + [ + ("nyp_20231208_google.txt", "20231208"), + ("nyp_20240101_google_recap.txt", "20240101"), + ], +) +def test_report_name_base_valid(arg, expectation): + assert fh_date(arg) == expectation + + +@pytest.mark.parametrize( + "arg", + ["foo", "20231208_google.txt", "nyp_foo_google.txt", "nyp-20231208-google.txt"], +) +def test_report_name_base_invalid(arg): + with pytest.raises(ValueError): + fh_date(arg)