From 0d87c2337e672ff75d2de5417ca88d68aeae98c9 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 20 Jun 2026 21:33:17 +0000 Subject: [PATCH] Add unit tests for unpack_csvlist utility function - Create tests/test_utils.py to test the dribdat.utils.unpack_csvlist function. - Cover empty inputs, normal comma-separated strings, list with extra whitespace, lists with duplicates, custom separators, and lists with empty elements. Co-authored-by: loleg <31819+loleg@users.noreply.github.com> --- tests/test_utils.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 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 00000000..464e8843 --- /dev/null +++ b/tests/test_utils.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +"""Utility unit tests.""" + +import pytest +from dribdat.utils import unpack_csvlist + +def test_unpack_csvlist_empty(): + assert unpack_csvlist(None) == [] + assert unpack_csvlist("") == [] + +def test_unpack_csvlist_normal(): + assert unpack_csvlist("a,b,c") == ["a", "b", "c"] + +def test_unpack_csvlist_whitespace(): + assert unpack_csvlist(" a , b,c ") == ["a", "b", "c"] + +def test_unpack_csvlist_duplicate(): + assert unpack_csvlist("a,b,a,c,b") == ["a", "b", "c"] + +def test_unpack_csvlist_custom_separator(): + assert unpack_csvlist("a|b|c", sep="|") == ["a", "b", "c"] + assert unpack_csvlist("a;b;a", sep=";") == ["a", "b"] + +def test_unpack_csvlist_empty_elements(): + assert unpack_csvlist("a,,b") == ["a", "", "b"] + assert unpack_csvlist("a, ,b") == ["a", "", "b"]