MCPcopy Create free account
hub / github.com/piccolo-orm/piccolo / test_all

Method test_all

tests/columns/test_array.py:65–88  ·  view source on GitHub ↗

Make sure rows can be retrieved where all items in an array match a given value.

(self)

Source from the content-addressed store, hash-verified

63
64 @engines_skip("sqlite")
65 def test_all(self):
66 """
67 Make sure rows can be retrieved where all items in an array match a
68 given value.
69 """
70 MyTable(value=[1, 1, 1]).save().run_sync()
71
72 # We have to explicitly specify the type, so CockroachDB works.
73 self.assertEqual(
74 MyTable.select(MyTable.value)
75 .where(MyTable.value.all(QueryString("{}::INTEGER", 1)))
76 .first()
77 .run_sync(),
78 {"value": [1, 1, 1]},
79 )
80
81 # We have to explicitly specify the type, so CockroachDB works.
82 self.assertEqual(
83 MyTable.select(MyTable.value)
84 .where(MyTable.value.all(QueryString("{}::INTEGER", 0)))
85 .first()
86 .run_sync(),
87 None,
88 )
89
90 @engines_skip("sqlite")
91 def test_any(self):

Callers

nothing calls this directly

Calls 9

QueryStringClass · 0.90
saveMethod · 0.80
assertEqualMethod · 0.80
selectMethod · 0.80
allMethod · 0.80
MyTableClass · 0.70
run_syncMethod · 0.45
firstMethod · 0.45
whereMethod · 0.45

Tested by

no test coverage detected