Code
Hub
Workspaces
Following
Digest
Agents
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/python/cpython
/ C
Class
C
Lib/test/test_contextlib.py:410–412 ·
view source on GitHub ↗
Source
from the content-addressed store, hash-verified
408
def
test_closing(self):
409
state = []
410
class
C:
411
def
close(self):
412
state.append(1)
413
x = C()
414
self.assertEqual(state, [])
415
with
closing(x)
as
y:
Callers
3
test_closing
Method · 0.70
test_closing_error
Method · 0.70
test_nullcontext
Method · 0.70
Calls
no outgoing calls
Tested by
3
test_closing
Method · 0.56
test_closing_error
Method · 0.56
test_nullcontext
Method · 0.56