@@ -1091,7 +1091,7 @@ async def test_extra_codec_alias(self):
10911091 # This should fail, as there is no binary codec for 
10921092 # my_dec_t and text decoding of composites is not 
10931093 # implemented. 
1094-  with  self .assertRaises (NotImplementedError ):
1094+  with  self .assertRaises (asyncpg . UnsupportedClientFeatureError ):
10951095 res  =  await  self .con .fetchval (''' 
10961096 SELECT ($1::my_dec_t, 'a=>1'::hstore)::rec_t AS result 
10971097 ''' , 44 )
@@ -1148,7 +1148,7 @@ def hstore_encoder(obj):
11481148 self .assertEqual (at [0 ].type , pt [0 ])
11491149
11501150 err  =  'cannot use custom codec on non-scalar type public._hstore' 
1151-  with  self .assertRaisesRegex (ValueError , err ):
1151+  with  self .assertRaisesRegex (asyncpg . InterfaceError , err ):
11521152 await  self .con .set_type_codec ('_hstore' ,
11531153 encoder = hstore_encoder ,
11541154 decoder = hstore_decoder )
@@ -1160,7 +1160,7 @@ def hstore_encoder(obj):
11601160 try :
11611161 err  =  'cannot use custom codec on non-scalar type '  +  \
11621162 'public.mytype' 
1163-  with  self .assertRaisesRegex (ValueError , err ):
1163+  with  self .assertRaisesRegex (asyncpg . InterfaceError , err ):
11641164 await  self .con .set_type_codec (
11651165 'mytype' , encoder = hstore_encoder ,
11661166 decoder = hstore_decoder )
@@ -1261,13 +1261,14 @@ async def test_custom_codec_on_domain(self):
12611261 ''' )
12621262
12631263 try :
1264-  await  self .con .set_type_codec (
1265-  'custom_codec_t' ,
1266-  encoder = lambda  v : str (v ),
1267-  decoder = lambda  v : int (v ))
1268- 
1269-  v  =  await  self .con .fetchval ('SELECT $1::custom_codec_t' , 10 )
1270-  self .assertEqual (v , 10 )
1264+  with  self .assertRaisesRegex (
1265+  asyncpg .UnsupportedClientFeatureError ,
1266+  'custom codecs on domain types are not supported' 
1267+  ):
1268+  await  self .con .set_type_codec (
1269+  'custom_codec_t' ,
1270+  encoder = lambda  v : str (v ),
1271+  decoder = lambda  v : int (v ))
12711272 finally :
12721273 await  self .con .execute ('DROP DOMAIN custom_codec_t' )
12731274
@@ -1666,7 +1667,7 @@ async def test_unknown_type_text_fallback(self):
16661667 # Text encoding of ranges and composite types 
16671668 # is not supported yet. 
16681669 with  self .assertRaisesRegex (
1669-  RuntimeError ,
1670+  asyncpg . UnsupportedClientFeatureError ,
16701671 'text encoding of range types is not supported' ):
16711672
16721673 await  self .con .fetchval (''' 
@@ -1675,7 +1676,7 @@ async def test_unknown_type_text_fallback(self):
16751676 ''' , ['a' , 'z' ])
16761677
16771678 with  self .assertRaisesRegex (
1678-  RuntimeError ,
1679+  asyncpg . UnsupportedClientFeatureError ,
16791680 'text encoding of composite types is not supported' ):
16801681
16811682 await  self .con .fetchval (''' 
@@ -1847,7 +1848,7 @@ async def test_custom_codec_large_oid(self):
18471848
18481849 expected_oid  =  self .LARGE_OID 
18491850 if  self .server_version  >=  (11 , 0 ):
1850-  # PostgreSQL 11 automatically create  a domain array type 
1851+  # PostgreSQL 11 automatically creates  a domain array type 
18511852 # _before_ the domain type, so the expected OID is 
18521853 # off by one. 
18531854 expected_oid  +=  1 
@@ -1858,14 +1859,5 @@ async def test_custom_codec_large_oid(self):
18581859 v  =  await  self .con .fetchval ('SELECT $1::test_domain_t' , 10 )
18591860 self .assertEqual (v , 10 )
18601861
1861-  # Test that custom codec logic handles large OIDs 
1862-  await  self .con .set_type_codec (
1863-  'test_domain_t' ,
1864-  encoder = lambda  v : str (v ),
1865-  decoder = lambda  v : int (v ))
1866- 
1867-  v  =  await  self .con .fetchval ('SELECT $1::test_domain_t' , 10 )
1868-  self .assertEqual (v , 10 )
1869- 
18701862 finally :
18711863 await  self .con .execute ('DROP DOMAIN test_domain_t' )
0 commit comments