MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_cols

Method test_cols

test/orm/test_query.py:4543–4564  ·  view source on GitHub ↗

test that column-based queries always nest.

(self)

Source from the content-addressed store, hash-verified

4541 )
4542
4543 def test_cols(self):
4544 """test that column-based queries always nest."""
4545
4546 User, Address = self.classes.User, self.classes.Address
4547
4548 s = fixture_session()
4549
4550 q = s.query(func.count(distinct(User.name)))
4551 eq_(q.count(), 1)
4552
4553 q = s.query(func.count(distinct(User.name))).distinct()
4554 eq_(q.count(), 1)
4555
4556 q = s.query(User.name)
4557 eq_(q.count(), 4)
4558
4559 q = s.query(User.name, Address).join(Address, true())
4560 eq_(q.count(), 20)
4561
4562 q = s.query(Address.user_id)
4563 eq_(q.count(), 5)
4564 eq_(q.distinct().count(), 3)
4565
4566 def test_cols_future(self):
4567 User, Address = self.classes.User, self.classes.Address

Callers

nothing calls this directly

Calls 8

fixture_sessionFunction · 0.90
distinctFunction · 0.90
eq_Function · 0.90
trueFunction · 0.90
queryMethod · 0.45
countMethod · 0.45
distinctMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected