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

Method test_custom_codec_large_oid

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

Source from the content-addressed store, hash-verified

2033 cls.start_cluster(cls.cluster)
2034
2035 async def test_custom_codec_large_oid(self):
2036 await self.con.execute('CREATE DOMAIN test_domain_t AS int')
2037 try:
2038 oid = await self.con.fetchval('''
2039 SELECT oid FROM pg_type WHERE typname = 'test_domain_t'
2040 ''')
2041
2042 expected_oid = self.LARGE_OID
2043 if self.server_version >= (11, 0):
2044 # PostgreSQL 11 automatically creates a domain array type
2045 # _before_ the domain type, so the expected OID is
2046 # off by one.
2047 expected_oid += 1
2048
2049 self.assertEqual(oid, expected_oid)
2050
2051 # Test that introspection handles large OIDs
2052 v = await self.con.fetchval('SELECT $1::test_domain_t', 10)
2053 self.assertEqual(v, 10)
2054
2055 finally:
2056 await self.con.execute('DROP DOMAIN test_domain_t')

Callers

nothing calls this directly

Calls 2

executeMethod · 0.45
fetchvalMethod · 0.45

Tested by

no test coverage detected