MCPcopy Create free account
hub / github.com/zzzeek/sqlalchemy / test_exists_regroup_modifiers

Method test_exists_regroup_modifiers

test/sql/test_selectable.py:3997–4021  ·  view source on GitHub ↗
(
        self, testcase, inner_select: testing.Variation
    )

Source from the content-addressed store, hash-verified

3995 )
3996 @testing.variation("inner_select", ["select", "compound"])
3997 def test_exists_regroup_modifiers(
3998 self, testcase, inner_select: testing.Variation
3999 ):
4000 a = table("a", column("x"), column("y"))
4001 b = table("b", column("x"), column("y"))
4002 if inner_select.compound:
4003 stmt = select(a.c.x).union_all(select(b.c.x))
4004 elif inner_select.select:
4005 stmt = select(a.c.x)
4006 else:
4007 inner_select.fail()
4008
4009 exists = stmt.exists()
4010
4011 if inner_select.compound:
4012 with expect_raises_message(
4013 exc.InvalidRequestError,
4014 "Can only apply this operation to a plain SELECT construct",
4015 ):
4016 testcase(exists, b)
4017 else:
4018 regrouped = testcase(exists, b)
4019 assert regrouped.element.compare(
4020 testcase(exists.element, b).scalar_subquery()
4021 )
4022
4023 def test_column_subquery_plain(self):
4024 t = self._fixture()

Callers

nothing calls this directly

Calls 9

tableFunction · 0.90
columnFunction · 0.90
selectFunction · 0.90
expect_raises_messageFunction · 0.90
union_allMethod · 0.45
failMethod · 0.45
existsMethod · 0.45
compareMethod · 0.45
scalar_subqueryMethod · 0.45

Tested by

no test coverage detected