mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-25 02:13:44 +03:00
Fix test for empty connect params with 'async' parameter
This commit is contained in:
parent
76db378e13
commit
bbe4227077
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue
Block a user