mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.14] Add test for opening an SQLite with bytes path (GH-136331) (GH-137632)
(cherry picked from commit 1bde13b0e9)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
181cecc5c0
commit
827c90b8b2
1 changed files with 8 additions and 0 deletions
|
|
@ -639,6 +639,14 @@ def test_deserialize_corrupt_database(self):
|
|||
class OpenTests(unittest.TestCase):
|
||||
_sql = "create table test(id integer)"
|
||||
|
||||
def test_open_with_bytes_path(self):
|
||||
path = os.fsencode(TESTFN)
|
||||
self.addCleanup(unlink, path)
|
||||
self.assertFalse(os.path.exists(path))
|
||||
with contextlib.closing(sqlite.connect(path)) as cx:
|
||||
self.assertTrue(os.path.exists(path))
|
||||
cx.execute(self._sql)
|
||||
|
||||
def test_open_with_path_like_object(self):
|
||||
""" Checks that we can successfully connect to a database using an object that
|
||||
is PathLike, i.e. has __fspath__(). """
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue