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

Method test_record_subclass_05

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

Source from the content-addressed store, hash-verified

518 self.assertIs(type(r[0]), asyncpg.Record)
519
520 async def test_record_subclass_05(self):
521 class MyRecord(asyncpg.Record):
522 pass
523
524 r = await self.con.fetchrow(
525 "SELECT 1 as a, '2' as b",
526 record_class=MyRecord,
527 )
528 self.assertIsInstance(r, MyRecord)
529 self.assertEqual(repr(r), "<MyRecord a=1 b='2'>")
530
531 self.assertEqual(list(r.items()), [('a', 1), ('b', '2')])
532 self.assertEqual(list(r.keys()), ['a', 'b'])
533 self.assertEqual(list(r.values()), [1, '2'])
534 self.assertIn('b', r)
535 self.assertEqual(next(iter(r)), 1)
536
537 async def test_record_subclass_06(self):
538 class MyRecord(asyncpg.Record):

Callers

nothing calls this directly

Calls 1

fetchrowMethod · 0.45

Tested by

no test coverage detected