| 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 | |
| 3940 | class AllTuplesTest(fixtures.TablesTest): |