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

Method test_custom_codec_composite_non_tuple

tests/test_codecs.py:1574–1592  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1572 ''')
1573
1574 async def test_custom_codec_composite_non_tuple(self):
1575 await self.con.execute('''
1576 CREATE TYPE mycomplex AS (r float, i float);
1577 ''')
1578
1579 try:
1580 with self.assertRaisesRegex(
1581 asyncpg.UnsupportedClientFeatureError,
1582 "only tuple-format codecs can be used on composite types",
1583 ):
1584 await self.con.set_type_codec(
1585 'mycomplex',
1586 encoder=lambda x: (x.real, x.imag),
1587 decoder=lambda t: complex(t[0], t[1]),
1588 )
1589 finally:
1590 await self.con.execute('''
1591 DROP TYPE mycomplex;
1592 ''')
1593
1594 async def test_timetz_encoding(self):
1595 try:

Callers

nothing calls this directly

Calls 2

set_type_codecMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected