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

Method test_keys_anon_labels

test/sql/test_resultset.py:1583–1600  ·  view source on GitHub ↗

test [ticket:3483]

(self, connection)

Source from the content-addressed store, hash-verified

1581 eq_(row.user_name, "foo")
1582
1583 def test_keys_anon_labels(self, connection):
1584 """test [ticket:3483]"""
1585
1586 users = self.tables.users
1587
1588 connection.execute(users.insert(), dict(user_id=1, user_name="foo"))
1589 result = connection.execute(
1590 select(
1591 users.c.user_id,
1592 users.c.user_name.label(None),
1593 func.count(literal_column("1")),
1594 ).group_by(users.c.user_id, users.c.user_name)
1595 )
1596
1597 eq_(result.keys(), ["user_id", "user_name_1", "count_1"])
1598 row = result.first()
1599 eq_(row._fields, ("user_id", "user_name_1", "count_1"))
1600 eq_(list(row._mapping.keys()), ["user_id", "user_name_1", "count_1"])
1601
1602 def test_items(self, connection):
1603 users = self.tables.users

Callers

nothing calls this directly

Calls 10

selectFunction · 0.90
literal_columnFunction · 0.90
eq_Function · 0.90
executeMethod · 0.45
insertMethod · 0.45
group_byMethod · 0.45
labelMethod · 0.45
countMethod · 0.45
keysMethod · 0.45
firstMethod · 0.45

Tested by

no test coverage detected