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

Method test_unregister

Lib/test/_test_atexit.py:96–109  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

94 self.assertEqual(a[0], 0)
95
96 def test_unregister(self):
97 a = [0]
98 def inc():
99 a[0] += 1
100 def dec():
101 a[0] -= 1
102
103 for i in range(4):
104 atexit.register(inc)
105 atexit.register(dec)
106 atexit.unregister(inc)
107 atexit._run_exitfuncs()
108
109 self.assertEqual(a[0], -1)
110
111 def test_bound_methods(self):
112 l = []

Callers

nothing calls this directly

Calls 3

registerMethod · 0.45
unregisterMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected