MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_union

Method test_union

test/sql/test_external_traversal.py:855–881  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

853 assert str(s4) == s4_assert
854
855 def test_union(self):
856 u = union(t1.select(), t2.select())
857 u2 = CloningVisitor().traverse(u)
858 eq_(str(u), str(u2))
859
860 eq_(
861 [str(c) for c in u2.selected_columns],
862 [str(c) for c in u.selected_columns],
863 )
864
865 u = union(t1.select(), t2.select())
866 cols = [str(c) for c in u.selected_columns]
867 u2 = CloningVisitor().traverse(u)
868 eq_(str(u), str(u2))
869 eq_([str(c) for c in u2.selected_columns], cols)
870
871 s1 = select(t1).where(t1.c.col1 == bindparam("id_param"))
872 s2 = select(t2)
873 u = union(s1, s2)
874
875 u2 = u.params(id_param=7)
876 u3 = u.params(id_param=10)
877
878 eq_(str(u), str(u2))
879 eq_(str(u2), str(u3))
880 eq_(u2.compile().params, {"id_param": 7})
881 eq_(u3.compile().params, {"id_param": 10})
882
883 def test_params_elements_in_setup_joins(self):
884 """test #7055"""

Callers

nothing calls this directly

Calls 9

unionFunction · 0.90
eq_Function · 0.90
selectFunction · 0.90
bindparamFunction · 0.90
selectMethod · 0.45
traverseMethod · 0.45
whereMethod · 0.45
paramsMethod · 0.45
compileMethod · 0.45

Tested by

no test coverage detected