MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_label_plus_element

Method test_label_plus_element

test/sql/test_compiler.py:7927–7946  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

7925 )
7926
7927 def test_label_plus_element(self):
7928 t = Table("t", MetaData(), Column("a", Integer))
7929 l1 = t.c.a.label("bar")
7930 tc = type_coerce(t.c.a + "str", String)
7931 stmt = select(t.c.a, l1, tc)
7932 comp = stmt.compile()
7933 tc_anon_label = comp._create_result_map()["anon_1"][1][0]
7934 eq_(
7935 comp._create_result_map(),
7936 {
7937 "a": ("a", (t.c.a, "a", "a", "t_a"), t.c.a.type, 0),
7938 "bar": ("bar", (l1, "bar"), l1.type, 1),
7939 "anon_1": (
7940 tc._anon_name_label,
7941 (tc_anon_label, "anon_1", tc, "_no_label"),
7942 tc.type,
7943 2,
7944 ),
7945 },
7946 )
7947
7948 def test_label_conflict_union(self):
7949 t1 = Table(

Callers

nothing calls this directly

Calls 9

TableClass · 0.90
MetaDataClass · 0.90
ColumnClass · 0.90
type_coerceFunction · 0.90
selectFunction · 0.90
eq_Function · 0.90
_create_result_mapMethod · 0.80
labelMethod · 0.45
compileMethod · 0.45

Tested by

no test coverage detected