From 474dd26727f865d2a999bfd04c5df644a614290a Mon Sep 17 00:00:00 2001 From: Karl Liu Date: Tue, 19 Nov 2024 15:41:25 +0100 Subject: [PATCH] add tests for nested arrays --- tests/orm/test_querybuilder.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/orm/test_querybuilder.py b/tests/orm/test_querybuilder.py index 0b2da78062..90419fb325 100644 --- a/tests/orm/test_querybuilder.py +++ b/tests/orm/test_querybuilder.py @@ -1720,6 +1720,15 @@ class TestJsonFilters: # contains empty set ({'arr': [1, '2', None]}, {'attributes.arr': {'contains': []}}, True), ({'arr': []}, {'attributes.arr': {'contains': []}}, True), + + # nested arrays + ({'arr': [[1, 0], [0, 2]]}, {'attributes.arr': {'contains': [[1, 0]]}}, True), + ({'arr': [[2, 3], [0, 1], []]}, {'attributes.arr': {'contains': [[1, 0]]}}, True), # order doesn't matter + ({'arr': [[2, 3], [1]]}, {'attributes.arr': {'contains': [[4]]}}, False), + + # TODO: the test below is supposed to pass but currently doesn't + # ({'arr': [[2, 3], [1]]}, {'attributes.arr': {'contains': [[2]]}}, False), + # negations ({'arr': [1, '2', None]}, {'attributes.arr': {'!contains': [1]}}, False), ({'arr': [1, '2', None]}, {'attributes.arr': {'!contains': []}}, False),