MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_union

Method test_union

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

Source from the content-addressed store, hash-verified

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