mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
bpo-42064: Move sqlite3
exceptions to global state, part 1 of 2 (GH-26745)
Also adds a test to verify the (borrowed) exceptions in `sqlite3.Connection`.
This commit is contained in:
parent
489699ca05
commit
a50e28377b
8 changed files with 66 additions and 48 deletions
|
@ -208,6 +208,24 @@ class ConnectionTests(unittest.TestCase):
|
|||
with self.assertRaises(AttributeError):
|
||||
self.cx.in_transaction = True
|
||||
|
||||
def test_connection_exceptions(self):
|
||||
exceptions = [
|
||||
"DataError",
|
||||
"DatabaseError",
|
||||
"Error",
|
||||
"IntegrityError",
|
||||
"InterfaceError",
|
||||
"NotSupportedError",
|
||||
"OperationalError",
|
||||
"ProgrammingError",
|
||||
"Warning",
|
||||
]
|
||||
for exc in exceptions:
|
||||
with self.subTest(exc=exc):
|
||||
self.assertTrue(hasattr(self.cx, exc))
|
||||
self.assertIs(getattr(sqlite, exc), getattr(self.cx, exc))
|
||||
|
||||
|
||||
class OpenTests(unittest.TestCase):
|
||||
_sql = "create table test(id integer)"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue