MCPcopy
hub / github.com/MagicStack/asyncpg / test_custom_codec_on_domain

Method test_custom_codec_on_domain

tests/test_codecs.py:1320–1336  ·  view source on GitHub ↗

Test encoding/decoding using a custom codec on a domain.

(self)

Source from the content-addressed store, hash-verified

1318 ''')
1319
1320 async def test_custom_codec_on_domain(self):
1321 """Test encoding/decoding using a custom codec on a domain."""
1322 await self.con.execute('''
1323 CREATE DOMAIN custom_codec_t AS int
1324 ''')
1325
1326 try:
1327 with self.assertRaisesRegex(
1328 asyncpg.UnsupportedClientFeatureError,
1329 'custom codecs on domain types are not supported'
1330 ):
1331 await self.con.set_type_codec(
1332 'custom_codec_t',
1333 encoder=lambda v: str(v),
1334 decoder=lambda v: int(v))
1335 finally:
1336 await self.con.execute('DROP DOMAIN custom_codec_t')
1337
1338 async def test_custom_codec_on_stdsql_types(self):
1339 types = [

Callers

nothing calls this directly

Calls 2

set_type_codecMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected