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

Method test_record_subclass_04

tests/test_record.py:484–528  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

482
483 @tb.with_connection_options(record_class=CustomRecord)
484 async def test_record_subclass_04(self):
485 r = await self.con.fetchrow(
486 "SELECT 1 as a, '2' as b",
487 record_class=asyncpg.Record,
488 )
489 self.assertIs(type(r), asyncpg.Record)
490
491 r = await self.con.fetch(
492 "SELECT 1 as a, '2' as b",
493 record_class=asyncpg.Record,
494 )
495 self.assertIs(type(r[0]), asyncpg.Record)
496
497 async with self.con.transaction():
498 cur = await self.con.cursor(
499 "SELECT 1 as a, '2' as b",
500 record_class=asyncpg.Record,
501 )
502 r = await cur.fetchrow()
503 self.assertIs(type(r), asyncpg.Record)
504
505 cur = await self.con.cursor(
506 "SELECT 1 as a, '2' as b",
507 record_class=asyncpg.Record,
508 )
509 r = await cur.fetch(1)
510 self.assertIs(type(r[0]), asyncpg.Record)
511
512 async with self.con.transaction():
513 cur = self.con.cursor(
514 "SELECT 1 as a, '2' as b",
515 record_class=asyncpg.Record,
516 )
517 async for r in cur:
518 self.assertIs(type(r), asyncpg.Record)
519
520 ps = await self.con.prepare(
521 "SELECT 1 as a, '2' as b",
522 record_class=asyncpg.Record,
523 )
524 r = await ps.fetchrow()
525 self.assertIs(type(r), asyncpg.Record)
526
527 r = await ps.fetch()
528 self.assertIs(type(r[0]), asyncpg.Record)
529
530 async def test_record_subclass_05(self):
531 class MyRecord(asyncpg.Record):

Callers

nothing calls this directly

Calls 5

transactionMethod · 0.80
fetchrowMethod · 0.45
fetchMethod · 0.45
cursorMethod · 0.45
prepareMethod · 0.45

Tested by

no test coverage detected