From 611c40fe0b1e667308a4c07af4efe1a8a365b4db Mon Sep 17 00:00:00 2001 From: Timmy Welch Date: Thu, 3 Aug 2023 01:06:10 -0700 Subject: [PATCH] Add test for split --- tests/utils_test.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/utils_test.py b/tests/utils_test.py index ee02b6a..7115ab9 100644 --- a/tests/utils_test.py +++ b/tests/utils_test.py @@ -218,3 +218,18 @@ urls = [ @pytest.mark.parametrize("value, result", urls) def test_fix_url(value, result): assert comictalker.talker_utils.fix_url(value) == result + + +split = [ + (("1,2,,3", ","), ["1", "2", "3"]), + (("1 ,2,,3", ","), ["1", "2", "3"]), + (("1 ,2,,3 ", ","), ["1", "2", "3"]), + (("\n1 \n2\n\n3 ", ","), ["1 \n2\n\n3"]), + (("\n1 \n2\n\n3 ", "\n"), ["1", "2", "3"]), + ((None, ","), []), +] + + +@pytest.mark.parametrize("value, result", split) +def test_split(value, result): + assert comicapi.utils.split(*value) == result