MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_query

Method test_query

test/ext/test_indexable.py:191–212  ·  test/ext/test_indexable.py::IndexPropertyArrayTest.test_query
(self)

Source from the content-addressed store, hash-verified

189 first0 = index_property(class="st">"array0", 0, onebased=False)
190
191 def test_query(self):
192 Array = self.classes.Array
193 s = Session(testing.db)
194
195 s.add_all(
196 [
197 Array(),
198 Array(array=[1, 2, 3], array0=[1, 2, 3]),
199 Array(array=[4, 5, 6], array0=[4, 5, 6]),
200 ]
201 )
202 s.commit()
203
204 a1 = s.query(Array).filter(Array.array == [1, 2, 3]).one()
205 a2 = s.query(Array).filter(Array.first == 1).one()
206 eq_(a1.id, a2.id)
207 a3 = s.query(Array).filter(Array.first == 4).one()
208 ne_(a1.id, a3.id)
209 a4 = s.query(Array).filter(Array.first0 == 1).one()
210 eq_(a1.id, a4.id)
211 a5 = s.query(Array).filter(Array.first0 == 4).one()
212 ne_(a1.id, a5.id)
213
214 def test_mutable(self):
215 Array = self.classes.Array

Callers

nothing calls this directly

Calls 9

add_allMethod · 0.95
commitMethod · 0.95
queryMethod · 0.95
SessionClass · 0.90
eq_Function · 0.90
ne_Function · 0.90
ArrayClass · 0.85
oneMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected