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

Method test_custom_codec_on_domain

tests/test_codecs.py:1366–1382  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

1364 ''')
1365
1366 async def test_custom_codec_on_domain(self):
1367 """Test encoding/decoding using a custom codec on a domain."""
1368 await self.con.execute('''
1369 CREATE DOMAIN custom_codec_t AS int
1370 ''')
1371
1372 try:
1373 with self.assertRaisesRegex(
1374 asyncpg.UnsupportedClientFeatureError,
1375 'custom codecs on domain types are not supported'
1376 ):
1377 await self.con.set_type_codec(
1378 'custom_codec_t',
1379 encoder=lambda v: str(v),
1380 decoder=lambda v: int(v))
1381 finally:
1382 await self.con.execute('DROP DOMAIN custom_codec_t')
1383
1384 async def test_custom_codec_on_stdsql_types(self):
1385 types = [

Callers

nothing calls this directly

Calls 2

set_type_codecMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected