MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_statement_error_w_code

Method test_statement_error_w_code

test/base/test_except.py:123–140  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

121 eq_(err.args, ("(sqlalchemy.exc.InvalidRequestError) hello",))
122
123 def test_statement_error_w_code(self):
124 try:
125 raise sa_exceptions.DBAPIError.instance(
126 "select * from table",
127 [{"x": 1}],
128 sa_exceptions.InvalidRequestError("hello", code="abcd"),
129 DatabaseError,
130 )
131 except sa_exceptions.StatementError as err:
132 eq_(
133 str(err),
134 "(sqlalchemy.exc.InvalidRequestError) hello\n"
135 "[SQL: select * from table]\n"
136 "[parameters: [{'x': 1}]]\n"
137 "(Background on this error at: https://sqlalche.me/e/%s/abcd)"
138 % sa_exceptions._version_token,
139 )
140 eq_(err.args, ("(sqlalchemy.exc.InvalidRequestError) hello",))
141
142 def test_wrap_multi_arg(self):
143 # this is not supported by the API but oslo_db is doing it

Callers

nothing calls this directly

Calls 2

eq_Function · 0.90
instanceMethod · 0.80

Tested by

no test coverage detected