diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2022-05-21 14:35:46 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-21 14:35:46 +0300 |
commit | 14c0d33016a967a98155f2e1615660e9328aef5d (patch) | |
tree | 210319151392d06e34646f0b4b2f8f2787c9cf31 /Lib/test/test_sqlite3/test_dbapi.py | |
parent | b96e20c1d9be4e6d5ea3e48c9c97e5ecd02f6055 (diff) | |
download | cpython-git-14c0d33016a967a98155f2e1615660e9328aef5d.tar.gz |
gh-93044: No longer convert the database argument of sqlite3.connect() to bytes (GH-93046)
Just pass it to the factory as is.
Diffstat (limited to 'Lib/test/test_sqlite3/test_dbapi.py')
-rw-r--r-- | Lib/test/test_sqlite3/test_dbapi.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_sqlite3/test_dbapi.py b/Lib/test/test_sqlite3/test_dbapi.py index 40f91a193b..f0c009afe4 100644 --- a/Lib/test/test_sqlite3/test_dbapi.py +++ b/Lib/test/test_sqlite3/test_dbapi.py @@ -676,6 +676,19 @@ class OpenTests(unittest.TestCase): with managed_connect(f"file:{TESTFN}?mode=ro", uri=True) as cx: cx.execute(self._sql) + def test_factory_database_arg(self): + def factory(database, *args, **kwargs): + nonlocal database_arg + database_arg = database + return sqlite.Connection(":memory:", *args, **kwargs) + + for database in (TESTFN, os.fsencode(TESTFN), + FakePath(TESTFN), FakePath(os.fsencode(TESTFN))): + database_arg = None + with sqlite.connect(database, factory=factory): + pass + self.assertEqual(database_arg, database) + def test_database_keyword(self): with sqlite.connect(database=":memory:") as cx: self.assertEqual(type(cx), sqlite.Connection) |