mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
gh-92547: Remove deprecated sqlite3 features (#92548)
The following sqlite3 features were deprecated in 3.10, scheduled for removal in 3.12: - sqlite3.OptimizedUnicode (gh-23163) - sqlite3.enable_shared_cache (gh-24008) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Signed-off-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
This commit is contained in:
parent
9b50585e02
commit
00f22e8cc2
8 changed files with 16 additions and 121 deletions
|
@ -344,15 +344,6 @@ class ModuleTests(unittest.TestCase):
|
|||
sqlite.SQLITE_CONSTRAINT_CHECK)
|
||||
self.assertEqual(exc.sqlite_errorname, "SQLITE_CONSTRAINT_CHECK")
|
||||
|
||||
# sqlite3_enable_shared_cache() is deprecated on macOS and calling it may raise
|
||||
# OperationalError on some buildbots.
|
||||
@unittest.skipIf(sys.platform == "darwin", "shared cache is deprecated on macOS")
|
||||
def test_shared_cache_deprecated(self):
|
||||
for enable in (True, False):
|
||||
with self.assertWarns(DeprecationWarning) as cm:
|
||||
sqlite.enable_shared_cache(enable)
|
||||
self.assertIn("dbapi.py", cm.filename)
|
||||
|
||||
def test_disallow_instantiation(self):
|
||||
cx = sqlite.connect(":memory:")
|
||||
check_disallow_instantiation(self, type(cx("select 1")))
|
||||
|
|
|
@ -256,18 +256,6 @@ class TextFactoryTests(unittest.TestCase):
|
|||
self.assertEqual(type(row[0]), str, "type of row[0] must be unicode")
|
||||
self.assertTrue(row[0].endswith("reich"), "column must contain original data")
|
||||
|
||||
def test_optimized_unicode(self):
|
||||
# OptimizedUnicode is deprecated as of Python 3.10
|
||||
with self.assertWarns(DeprecationWarning) as cm:
|
||||
self.con.text_factory = sqlite.OptimizedUnicode
|
||||
self.assertIn("factory.py", cm.filename)
|
||||
austria = "Österreich"
|
||||
germany = "Deutchland"
|
||||
a_row = self.con.execute("select ?", (austria,)).fetchone()
|
||||
d_row = self.con.execute("select ?", (germany,)).fetchone()
|
||||
self.assertEqual(type(a_row[0]), str, "type of non-ASCII row must be str")
|
||||
self.assertEqual(type(d_row[0]), str, "type of ASCII-only row must be str")
|
||||
|
||||
def tearDown(self):
|
||||
self.con.close()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue