Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add tests
  • Loading branch information
Erlend E. Aasland committed Oct 7, 2021
commit a29499a2c1c7ad0522d8ca2be200c073810dd063
16 changes: 16 additions & 0 deletions Lib/sqlite3/test/test_dbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,15 @@ def test_connection_limits(self):
finally: # restore old limit
self.cx.SQLITE_LIMIT_SQL_LENGTH = limit

def test_connection_delete_limit(self):
msg = "Cannot delete limit attributes"
with self.assertRaisesRegex(sqlite.ProgrammingError, msg):
del self.cx.SQLITE_LIMIT_LENGTH

def test_connection_bad_set_limit(self):
with self.assertRaises(TypeError):
self.cx.SQLITE_LIMIT_EXPR_DEPTH = "a"


class UninitialisedConnectionTests(unittest.TestCase):
def setUp(self):
Expand Down Expand Up @@ -771,6 +780,11 @@ def run(err):
self.fail("\n".join(err))

def test_check_connection_thread(self):
def set_cx_limit():
self.con.SQLITE_LIMIT_LENGTH = 0
def get_cx_limit():
return self.con.SQLITE_LIMIT_LENGTH

fns = [
lambda: self.con.cursor(),
lambda: self.con.commit(),
Expand All @@ -779,6 +793,8 @@ def test_check_connection_thread(self):
lambda: self.con.set_trace_callback(None),
lambda: self.con.set_authorizer(None),
lambda: self.con.create_collation("foo", None),
lambda: set_cx_limit(),
lambda: get_cx_limit(),
]
for fn in fns:
with self.subTest(fn=fn):
Expand Down