MCPcopy Index your code
hub / github.com/python/cpython / test_closing

Method test_closing

Lib/test/test_contextlib.py:408–417  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

406 self.assertEqual(obj.__doc__, cm_docstring)
407
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:
416 self.assertEqual(x, y)
417 self.assertEqual(state, [1])
418
419 def test_closing_error(self):
420 state = []

Callers

nothing calls this directly

Calls 3

closingClass · 0.85
CClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected