From bbe4227077408561107a378fe24cac3ca1a78139 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Sat, 22 May 2021 15:56:46 +0200 Subject: [PATCH] Fix test for empty connect params with 'async' parameter --- tests/test_async_keyword.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/tests/test_async_keyword.py b/tests/test_async_keyword.py index e1126928..2376e2ac 100755 --- a/tests/test_async_keyword.py +++ b/tests/test_async_keyword.py @@ -138,12 +138,23 @@ class ConnectTestCase(unittest.TestCase): def tearDown(self): psycopg2._connect = self._connect_orig - def test_there_has_to_be_something(self): - self.assertRaises(TypeError, psycopg2.connect) - self.assertRaises(TypeError, psycopg2.connect, + def test_there_might_be_nothing(self): + psycopg2.connect() + self.assertEqual(self.args[0], '') + self.assertEqual(self.args[1], None) + self.assertEqual(self.args[2], False) + + psycopg2.connect( connection_factory=lambda dsn, async=False: None) - self.assertRaises(TypeError, psycopg2.connect, - async=True) + self.assertEqual(self.args[0], '') + self.assertNotEqual(self.args[1], None) + self.assertEqual(self.args[2], False) + + psycopg2.connect(async=True) + self.assertEqual(self.args[0], '') + self.assertEqual(self.args[1], None) + self.assertEqual(self.args[2], True) + def test_factory(self): def f(dsn, async=False):