MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_column

Method test_column

test/ext/test_compiler.py:38–56  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

36 __dialect__ = "default"
37
38 def test_column(self):
39 class MyThingy(ColumnClause):
40 inherit_cache = False
41
42 def __init__(self, arg=None):
43 super().__init__(arg or "MYTHINGY!")
44
45 @compiles(MyThingy)
46 def visit_thingy(thingy, compiler, **kw):
47 return ">>%s<<" % thingy.name
48
49 self.assert_compile(
50 select(column("foo"), MyThingy()), "SELECT foo, >>MYTHINGY!<<"
51 )
52
53 self.assert_compile(
54 select(MyThingy("x"), MyThingy("y")).where(MyThingy() == 5),
55 "SELECT >>x<<, >>y<< WHERE >>MYTHINGY!<< = :MYTHINGY!_1",
56 )
57
58 def test_create_column_skip(self):
59 @compiles(CreateColumn)

Callers

nothing calls this directly

Calls 5

selectFunction · 0.90
columnFunction · 0.90
MyThingyClass · 0.85
assert_compileMethod · 0.80
whereMethod · 0.45

Tested by

no test coverage detected