def test_select_distinct_limit(self):

        r = sorted(
            [x[0] for x in select([addresses.c.address]).distinct().
                limit(3).order_by(addresses.c.address).execute().fetchall()])
        self.assert_(len(r) == 3, repr(r))
        self.assert_(r[0] != r[1] and r[1] != r[2], repr(r))
Test the interaction between limit and distinct
dataset/ETHPy150Open zzzeek/sqlalchemy/test/sql/test_query.py/LimitTest.test_select_distinct_limit