Make sure rows can be retrieved where any items in an array match a given value.
(self)
| 89 | |
| 90 | @engines_skip("sqlite") |
| 91 | def test_any(self): |
| 92 | """ |
| 93 | Make sure rows can be retrieved where any items in an array match a |
| 94 | given value. |
| 95 | """ |
| 96 | MyTable(value=[1, 2, 3]).save().run_sync() |
| 97 | |
| 98 | # We have to explicitly specify the type, so CockroachDB works. |
| 99 | self.assertEqual( |
| 100 | MyTable.select(MyTable.value) |
| 101 | .where(MyTable.value.any(QueryString("{}::INTEGER", 1))) |
| 102 | .first() |
| 103 | .run_sync(), |
| 104 | {"value": [1, 2, 3]}, |
| 105 | ) |
| 106 | |
| 107 | # We have to explicitly specify the type, so CockroachDB works. |
| 108 | self.assertEqual( |
| 109 | MyTable.select(MyTable.value) |
| 110 | .where(MyTable.value.any(QueryString("{}::INTEGER", 0))) |
| 111 | .first() |
| 112 | .run_sync(), |
| 113 | None, |
| 114 | ) |
| 115 | |
| 116 | @engines_skip("sqlite") |
| 117 | def test_not_any(self): |
nothing calls this directly
no test coverage detected