MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_keys_anon_labels

Method test_keys_anon_labels

test/sql/test_resultset.py:1648–1665  ·  view source on GitHub ↗

test [ticket:3483]

(self, connection)

Source from the content-addressed store, hash-verified

1646 eq_(row.user_name, "foo")
1647
1648 def test_keys_anon_labels(self, connection):
1649 """test [ticket:3483]"""
1650
1651 users = self.tables.users
1652
1653 connection.execute(users.insert(), dict(user_id=1, user_name="foo"))
1654 result = connection.execute(
1655 select(
1656 users.c.user_id,
1657 users.c.user_name.label(None),
1658 func.count(literal_column("1")),
1659 ).group_by(users.c.user_id, users.c.user_name)
1660 )
1661
1662 eq_(result.keys(), ["user_id", "user_name_1", "count_1"])
1663 row = result.first()
1664 eq_(row._fields, ("user_id", "user_name_1", "count_1"))
1665 eq_(list(row._mapping.keys()), ["user_id", "user_name_1", "count_1"])
1666
1667 def test_items(self, connection):
1668 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