6
6
7
7
8
8
from asyncpg import _testbase as tb
9
+ from asyncpg import connection as apg_con
9
10
10
11
11
12
MAX_RUNTIME = 0.1
@@ -47,6 +48,8 @@ async def test_introspection_on_large_db(self):
47
48
48
49
@tb .with_connection_options (statement_cache_size = 0 )
49
50
async def test_introspection_no_stmt_cache_01 (self ):
51
+ old_uid = apg_con ._uid
52
+
50
53
self .assertEqual (self .con ._stmt_cache .get_max_size (), 0 )
51
54
await self .con .fetchval ('SELECT $1::int[]' , [1 , 2 ])
52
55
@@ -62,12 +65,14 @@ async def test_introspection_no_stmt_cache_01(self):
62
65
DROP EXTENSION hstore
63
66
''' )
64
67
65
- self .assertEqual (self . con . _uid , 0 )
68
+ self .assertEqual (apg_con . _uid , old_uid )
66
69
67
70
@tb .with_connection_options (max_cacheable_statement_size = 1 )
68
71
async def test_introspection_no_stmt_cache_02 (self ):
69
72
# max_cacheable_statement_size will disable caching both for
70
73
# the user query and for the introspection query.
74
+ old_uid = apg_con ._uid
75
+
71
76
await self .con .fetchval ('SELECT $1::int[]' , [1 , 2 ])
72
77
73
78
await self .con .execute ('''
@@ -82,13 +87,15 @@ async def test_introspection_no_stmt_cache_02(self):
82
87
DROP EXTENSION hstore
83
88
''' )
84
89
85
- self .assertEqual (self . con . _uid , 0 )
90
+ self .assertEqual (apg_con . _uid , old_uid )
86
91
87
92
@tb .with_connection_options (max_cacheable_statement_size = 10000 )
88
93
async def test_introspection_no_stmt_cache_03 (self ):
89
94
# max_cacheable_statement_size will disable caching for
90
95
# the user query but not for the introspection query.
96
+ old_uid = apg_con ._uid
97
+
91
98
await self .con .fetchval (
92
99
"SELECT $1::int[], '{foo}'" .format (foo = 'a' * 10000 ), [1 , 2 ])
93
100
94
- self .assertEqual (self . con . _uid , 1 )
101
+ self .assertEqual (apg_con . _uid , old_uid + 1 )
0 commit comments