MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_select_distinct_limit

Method test_select_distinct_limit

test/sql/test_query.py:957–971  ·  view source on GitHub ↗

Test the interaction between limit and distinct

(self, connection)

Source from the content-addressed store, hash-verified

955 self.assert_(r == [(6, "ralph"), (7, "fido")])
956
957 def test_select_distinct_limit(self, connection):
958 """Test the interaction between limit and distinct"""
959
960 users, addresses = self.tables("users", "addresses")
961
962 r = sorted(
963 [
964 x[0]
965 for x in connection.execute(
966 select(addresses.c.address).distinct().limit(3)
967 )
968 ]
969 )
970 self.assert_(len(r) == 3, repr(r))
971 self.assert_(r[0] != r[1] and r[1] != r[2], repr(r))
972
973 @testing.requires.offset
974 def test_select_distinct_offset(self, connection):

Callers

nothing calls this directly

Calls 5

selectFunction · 0.90
executeMethod · 0.45
limitMethod · 0.45
distinctMethod · 0.45
assert_Method · 0.45

Tested by

no test coverage detected