File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -264,3 +264,27 @@ async def mock_disconnect():
264264
265265 assert calls == 1
266266 await pool .disconnect ()
267+
268+
269+ @pytest .mark .onlynoncluster
270+ async def test_repr_correctly_represents_connection_object (sentinel ):
271+ pool = SentinelConnectionPool ("mymaster" , sentinel )
272+ connection = await pool .get_connection ("PING" )
273+
274+ assert (
275+ str (connection )
276+ == "<redis.asyncio.sentinel.SentinelManagedConnection,host=127.0.0.1,port=6379)>"
277+ )
278+ assert connection .connection_pool == pool
279+ await pool .release (connection )
280+
281+ del pool
282+
283+ assert (
284+ str (connection )
285+ == "<redis.asyncio.sentinel.SentinelManagedConnection,host=127.0.0.1,port=6379)>"
286+ )
287+ with pytest .raises (
288+ ReferenceError , match = "weakly-referenced object no longer exists"
289+ ):
290+ assert connection .connection_pool
You can’t perform that action at this time.
0 commit comments