def test_inner_limit(self):
        compound_db.compound_select_parentheses = True
        a1 = Alpha.select(Alpha.alpha).where(Alpha.alpha < 2).limit(2)
        a2 = Alpha.select(Alpha.alpha).where(Alpha.alpha > 5).limit(4)
        sql, params = (a1 | a2).limit(3).sql()

        self.assertEqual(sql, (
            '(SELECT "t1"."alpha" FROM "alpha" AS t1 WHERE ("t1"."alpha" < ?) '
            'LIMIT 2) '
            'UNION '
            '(SELECT "t2"."alpha" FROM "alpha" AS t2 WHERE ("t2"."alpha" > ?) '
            'LIMIT 4) '
            'LIMIT 3'))
dataset/ETHPy150Open coleifer/peewee/playhouse/tests/test_compound_queries.py/TestCompoundSelectSQL.test_inner_limit/original