MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_subclass

Method test_subclass

test/orm/test_bundle.py:319–339  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

317 )
318
319 def test_subclass(self):
320 Data = self.classes.Data
321 sess = fixture_session()
322
323 class MyBundle(Bundle):
324 def create_row_processor(self, query, procs, labels):
325 def proc(row):
326 return dict(zip(labels, (proc(row) for proc in procs)))
327
328 return proc
329
330 b1 = MyBundle("b1", Data.d1, Data.d2)
331
332 eq_(
333 sess.query(b1).filter(b1.c.d1.between("d3d1", "d5d1")).all(),
334 [
335 ({"d2": "d3d2", "d1": "d3d1"},),
336 ({"d2": "d4d2", "d1": "d4d1"},),
337 ({"d2": "d5d2", "d1": "d5d1"},),
338 ],
339 )
340
341 def test_multi_bundle(self):
342 Data = self.classes.Data

Callers

nothing calls this directly

Calls 7

fixture_sessionFunction · 0.90
eq_Function · 0.90
MyBundleClass · 0.85
allMethod · 0.45
filterMethod · 0.45
queryMethod · 0.45
betweenMethod · 0.45

Tested by

no test coverage detected