66
77
88from asyncpg import _testbase as tb
9+ from asyncpg import connection as apg_con
910
1011
1112MAX_RUNTIME = 0.1
@@ -47,6 +48,8 @@ async def test_introspection_on_large_db(self):
4748
4849 @tb .with_connection_options (statement_cache_size = 0 )
4950 async def test_introspection_no_stmt_cache_01 (self ):
51+ old_uid = apg_con ._uid
52+
5053 self .assertEqual (self .con ._stmt_cache .get_max_size (), 0 )
5154 await self .con .fetchval ('SELECT $1::int[]' , [1 , 2 ])
5255
@@ -62,12 +65,14 @@ async def test_introspection_no_stmt_cache_01(self):
6265 DROP EXTENSION hstore
6366 ''' )
6467
65- self .assertEqual (self . con . _uid , 0 )
68+ self .assertEqual (apg_con . _uid , old_uid )
6669
6770 @tb .with_connection_options (max_cacheable_statement_size = 1 )
6871 async def test_introspection_no_stmt_cache_02 (self ):
6972 # max_cacheable_statement_size will disable caching both for
7073 # the user query and for the introspection query.
74+ old_uid = apg_con ._uid
75+
7176 await self .con .fetchval ('SELECT $1::int[]' , [1 , 2 ])
7277
7378 await self .con .execute ('''
@@ -82,13 +87,15 @@ async def test_introspection_no_stmt_cache_02(self):
8287 DROP EXTENSION hstore
8388 ''' )
8489
85- self .assertEqual (self . con . _uid , 0 )
90+ self .assertEqual (apg_con . _uid , old_uid )
8691
8792 @tb .with_connection_options (max_cacheable_statement_size = 10000 )
8893 async def test_introspection_no_stmt_cache_03 (self ):
8994 # max_cacheable_statement_size will disable caching for
9095 # the user query but not for the introspection query.
96+ old_uid = apg_con ._uid
97+
9198 await self .con .fetchval (
9299 "SELECT $1::int[], '{foo}'" .format (foo = 'a' * 10000 ), [1 , 2 ])
93100
94- self .assertEqual (self . con . _uid , 1 )
101+ self .assertEqual (apg_con . _uid , old_uid + 1 )
0 commit comments