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

Method test_dont_access_statement

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

Source from the content-addressed store, hash-verified

192
193class TestCompilerFixture(fixtures.TestBase, AssertsCompiledSQL):
194 def test_dont_access_statement(self):
195 def visit_foobar(self, element, **kw):
196 self.statement.table
197
198 class Foobar(ClauseElement):
199 __visit_name__ = "foobar"
200
201 with mock.patch.object(
202 testing.db.dialect.statement_compiler,
203 "visit_foobar",
204 visit_foobar,
205 create=True,
206 ):
207 assert_raises_message(
208 NotImplementedError,
209 "compiler accessed .statement; use "
210 "compiler.current_executable",
211 self.assert_compile,
212 Foobar(),
213 "",
214 )
215
216 def test_no_stack(self):
217 def visit_foobar(self, element, **kw):

Callers

nothing calls this directly

Calls 3

assert_raises_messageFunction · 0.90
objectMethod · 0.80
FoobarClass · 0.70

Tested by

no test coverage detected