| 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 | |
| 127 | class TestConnectionCommandTimeout(tb.ConnectedTestCase): |