MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / expect_warnings_on

Function expect_warnings_on

lib/sqlalchemy/testing/assertions.py:54–67  ·  view source on GitHub ↗

Context manager which expects one or more warnings on specific dialects. The expect version **asserts** that the warnings were in fact seen.

(db, *messages, **kw)

Source from the content-addressed store, hash-verified

52
53@contextlib.contextmanager
54def expect_warnings_on(db, *messages, **kw):
55 """Context manager which expects one or more warnings on specific
56 dialects.
57
58 The expect version **asserts** that the warnings were in fact seen.
59
60 """
61 spec = db_spec(db)
62
63 if isinstance(db, str) and not spec(config._current):
64 yield
65 else:
66 with expect_warnings(*messages, **kw):
67 yield
68
69
70def emits_warning(*messages):

Callers 1

decorateFunction · 0.85

Calls 2

db_specFunction · 0.85
expect_warningsFunction · 0.85

Tested by

no test coverage detected