MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / test_invalid_timeout

Method test_invalid_timeout

tests/test_timeout.py:112–124  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

110 self.assertEqual(await self.con.fetch('select 1'), [(1,)])
111
112 async def test_invalid_timeout(self):
113 for command_timeout in ('a', False, -1):
114 with self.subTest(command_timeout=command_timeout):
115 with self.assertRaisesRegex(ValueError,
116 'invalid command_timeout'):
117 await self.connect(command_timeout=command_timeout)
118
119 # Note: negative timeouts are OK for method calls.
120 for methname in {'fetch', 'fetchrow', 'fetchval', 'execute'}:
121 for timeout in ('a', False):
122 with self.subTest(timeout=timeout):
123 with self.assertRaisesRegex(ValueError, 'invalid timeout'):
124 await self.con.execute('SELECT 1', timeout=timeout)
125
126
127class TestConnectionCommandTimeout(tb.ConnectedTestCase):

Callers

nothing calls this directly

Calls 2

connectMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected