(self)
| 425 | |
| 426 | @tb.with_connection_options(record_class=AnotherCustomRecord) |
| 427 | async def test_record_subclass_03(self): |
| 428 | r = await self.con.fetchrow( |
| 429 | "SELECT 1 as a, '2' as b", |
| 430 | record_class=CustomRecord, |
| 431 | ) |
| 432 | self.assertIsInstance(r, CustomRecord) |
| 433 | |
| 434 | r = await self.con.fetch( |
| 435 | "SELECT 1 as a, '2' as b", |
| 436 | record_class=CustomRecord, |
| 437 | ) |
| 438 | self.assertIsInstance(r[0], CustomRecord) |
| 439 | |
| 440 | async with self.con.transaction(): |
| 441 | cur = await self.con.cursor( |
| 442 | "SELECT 1 as a, '2' as b", |
| 443 | record_class=CustomRecord, |
| 444 | ) |
| 445 | r = await cur.fetchrow() |
| 446 | self.assertIsInstance(r, CustomRecord) |
| 447 | |
| 448 | cur = await self.con.cursor( |
| 449 | "SELECT 1 as a, '2' as b", |
| 450 | record_class=CustomRecord, |
| 451 | ) |
| 452 | r = await cur.fetch(1) |
| 453 | self.assertIsInstance(r[0], CustomRecord) |
| 454 | |
| 455 | async with self.con.transaction(): |
| 456 | cur = self.con.cursor( |
| 457 | "SELECT 1 as a, '2' as b", |
| 458 | record_class=CustomRecord, |
| 459 | ) |
| 460 | async for r in cur: |
| 461 | self.assertIsInstance(r, CustomRecord) |
| 462 | |
| 463 | ps = await self.con.prepare( |
| 464 | "SELECT 1 as a, '2' as b", |
| 465 | record_class=CustomRecord, |
| 466 | ) |
| 467 | r = await ps.fetchrow() |
| 468 | self.assertIsInstance(r, CustomRecord) |
| 469 | |
| 470 | r = await ps.fetch() |
| 471 | self.assertIsInstance(r[0], CustomRecord) |
| 472 | |
| 473 | @tb.with_connection_options(record_class=CustomRecord) |
| 474 | async def test_record_subclass_04(self): |
nothing calls this directly
no test coverage detected