summaryrefslogtreecommitdiff
path: root/tests/test_utils.py
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2021-04-28 11:04:48 +0300
committerYuval Adam <_@yuv.al>2021-04-28 11:06:08 +0300
commitf64265e7fbc483f1895eb3297c81f045822af45c (patch)
tree369b581329b3957a2624d2b8a21b362d21b2bc1c /tests/test_utils.py
parentd71ef41dee820f8403bc7c57bcf3bc5756806549 (diff)
Convert lists to tuples to make dict keys hashable, fixes #24list-hash
Diffstat (limited to 'tests/test_utils.py')
-rw-r--r--tests/test_utils.py12
1 files changed, 12 insertions, 0 deletions
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"