Make sure rows can be retrieved where all items in an array match a given value.
(self)
| 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): |
nothing calls this directly
no test coverage detected