From f64265e7fbc483f1895eb3297c81f045822af45c Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Wed, 28 Apr 2021 11:04:48 +0300 Subject: Convert lists to tuples to make dict keys hashable, fixes #24 --- tests/test_utils.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/test_utils.py (limited to 'tests/test_utils.py') diff --git a/tests/test_utils.py b/tests/test_utils.py new file mode 100644 index 0000000..f7f8b00 --- /dev/null +++ b/tests/test_utils.py @@ -0,0 +1,12 @@ +from viewstate.utils import list_to_tuple + + +def test_list_to_tuple(): + assert list_to_tuple([1, 2, 3]) == (1, 2, 3) + assert list_to_tuple((9, 8, 7)) == (9, 8, 7) + assert list_to_tuple((None, [2, 3, None])) == (None, (2, 3, None)) + assert list_to_tuple(("abc", [2, [3], (9, 8, True, False)])) == ( + "abc", + (2, (3,), (9, 8, True, False)), + ) + assert list_to_tuple("abc") == "abc" -- cgit v1.3.1