class WrapTest(fixtures.TestBase):
+ def test_version_token(self):
+ assert sa_exceptions._version_token in (
+ "13",
+ "14",
+ "15",
+ "16",
+ "20",
+ "21",
+ "22",
+ )
+
def _translating_dialect_fixture(self):
d = default.DefaultDialect()
d.dbapi_exception_translation_map = {
str(exc),
"(test.base.test_except.OperationalError) \n"
"[SQL: this is a message]\n"
- "(Background on this error at: http://sqlalche.me/e/e3q8)",
+ "(Background on this error at: http://sqlalche.me/e/%s/e3q8)"
+ % sa_exceptions._version_token,
)
def test_tostring_with_newlines(self):
"(test.base.test_except.OperationalError) \n"
"[SQL: this is a message\nthis is the next line\n"
"the last line]\n"
- "(Background on this error at: http://sqlalche.me/e/e3q8)",
+ "(Background on this error at: http://sqlalche.me/e/%s/e3q8)"
+ % sa_exceptions._version_token,
)
def test_statement_error_no_code(self):
"(sqlalchemy.exc.InvalidRequestError) hello\n"
"[SQL: select * from table]\n"
"[parameters: [{'x': 1}]]\n"
- "(Background on this error at: http://sqlalche.me/e/abcd)",
+ "(Background on this error at: http://sqlalche.me/e/%s/abcd)"
+ % sa_exceptions._version_token,
)
eq_(err.args, ("(sqlalchemy.exc.InvalidRequestError) hello",))
eq_(
str(orig),
"(2006, 'Test raise operational error')\n"
- "(Background on this error at: http://sqlalche.me/e/dbapi)",
+ "(Background on this error at: http://sqlalche.me/e/%s/dbapi)"
+ % sa_exceptions._version_token,
)
def test_wrap_unicode_arg(self):
compat.text_type(orig),
compat.u(
"méil\n(Background on this error at: "
- "http://sqlalche.me/e/dbapi)"
+ "http://sqlalche.me/e/%s/dbapi)" % sa_exceptions._version_token
),
)
eq_(orig.args, (u("méil"),))
"[SQL: this is a message]\n"
"[parameters: [{1: 1}, {1: 1}, {1: 1}, {1: 1}, {1: 1},"
" {1: 1}, {1: 1}, {1: 1}, {1: 1}, {1: 1}]]\n"
- "(Background on this error at: http://sqlalche.me/e/e3q8)",
+ "(Background on this error at: http://sqlalche.me/e/%s/e3q8)"
+ % sa_exceptions._version_token,
)
eq_(
exc.args,
"{1: 1}, {1: 1}, {1: 1}, {1: 1}, {1: 1}, "
"{1: 1}, {1: 1} ... displaying 10 of 11 total "
"bound parameter sets ... {1: 1}, {1: 1}]]\n"
- "(Background on this error at: http://sqlalche.me/e/e3q8)",
+ "(Background on this error at: http://sqlalche.me/e/%s/e3q8)"
+ % sa_exceptions._version_token,
)
try:
raise sa_exceptions.DBAPIError.instance(
"[SQL: this is a message]\n"
"[parameters: [(1,), "
"(1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,)]]\n"
- "(Background on this error at: http://sqlalche.me/e/e3q8)",
+ "(Background on this error at: http://sqlalche.me/e/%s/e3q8)"
+ % sa_exceptions._version_token,
)
try:
raise sa_exceptions.DBAPIError.instance(
"(1,), (1,), (1,), (1,), (1,), (1,), (1,) "
"... displaying 10 of 11 total bound "
"parameter sets ... (1,), (1,)]]\n"
- "(Background on this error at: http://sqlalche.me/e/e3q8)",
+ "(Background on this error at: http://sqlalche.me/e/%s/e3q8)"
+ % sa_exceptions._version_token,
)
def test_db_error_busted_dbapi(self):