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:1620–1638  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1618 ''')
1619
1620 async def test_custom_codec_composite_non_tuple(self):
1621 await self.con.execute('''
1622 CREATE TYPE mycomplex AS (r float, i float);
1623 ''')
1624
1625 try:
1626 with self.assertRaisesRegex(
1627 asyncpg.UnsupportedClientFeatureError,
1628 "only tuple-format codecs can be used on composite types",
1629 ):
1630 await self.con.set_type_codec(
1631 'mycomplex',
1632 encoder=lambda x: (x.real, x.imag),
1633 decoder=lambda t: complex(t[0], t[1]),
1634 )
1635 finally:
1636 await self.con.execute('''
1637 DROP TYPE mycomplex;
1638 ''')
1639
1640 async def test_timetz_encoding(self):
1641 try:

Callers

nothing calls this directly

Calls 2

set_type_codecMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected