diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_sqlite3/test_factory.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_sqlite3/test_factory.py b/Lib/test/test_sqlite3/test_factory.py index 71603fa..7fdc45a 100644 --- a/Lib/test/test_sqlite3/test_factory.py +++ b/Lib/test/test_sqlite3/test_factory.py @@ -50,6 +50,26 @@ class ConnectionFactoryTests(unittest.TestCase): con = sqlite.connect(":memory:", factory=factory) self.assertIsInstance(con, factory) + def test_connection_factory_relayed_call(self): + # gh-95132: keyword args must not be passed as positional args + class Factory(sqlite.Connection): + def __init__(self, *args, **kwargs): + kwargs["isolation_level"] = None + super(Factory, self).__init__(*args, **kwargs) + + con = sqlite.connect(":memory:", factory=Factory) + self.assertIsNone(con.isolation_level) + self.assertIsInstance(con, Factory) + + def test_connection_factory_as_positional_arg(self): + class Factory(sqlite.Connection): + def __init__(self, *args, **kwargs): + super(Factory, self).__init__(*args, **kwargs) + + con = sqlite.connect(":memory:", 5.0, 0, None, True, Factory) + self.assertIsNone(con.isolation_level) + self.assertIsInstance(con, Factory) + class CursorFactoryTests(unittest.TestCase): def setUp(self): |