MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_partitions

Method test_partitions

test/sql/test_resultset.py:3912–3937  ·  view source on GitHub ↗
(self, connection)

Source from the content-addressed store, hash-verified

3910 eq_(getter(result.first()), 2)
3911
3912 def test_partitions(self, connection):
3913 users = self.tables.users
3914 connection.execute(
3915 users.insert(),
3916 [
3917 {
3918 "user_id": i,
3919 "user_name": "user %s" % i,
3920 "x": i * 5,
3921 "y": i * 20,
3922 }
3923 for i in range(500)
3924 ],
3925 )
3926
3927 result = connection.execute(select(users).order_by(users.c.user_id))
3928
3929 start = 0
3930 for partition in result.columns(0, 1).partitions(20):
3931 eq_(
3932 partition,
3933 [(i, "user %s" % i) for i in range(start, start + 20)],
3934 )
3935 start += 20
3936
3937 assert result._soft_closed
3938
3939
3940class AllTuplesTest(fixtures.TablesTest):

Callers

nothing calls this directly

Calls 7

selectFunction · 0.90
eq_Function · 0.90
executeMethod · 0.45
insertMethod · 0.45
order_byMethod · 0.45
partitionsMethod · 0.45
columnsMethod · 0.45

Tested by

no test coverage detected