MCPcopy Create free account
hub / github.com/python/cpython / test_eq_unregister_clear

Method test_eq_unregister_clear

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

Source from the content-addressed store, hash-verified

136 atexit.unregister(func)
137
138 def test_eq_unregister_clear(self):
139 # Issue #112127: callback's __eq__ may call unregister or _clear
140 class Evil:
141 def __eq__(self, other):
142 action(other)
143 return NotImplemented
144
145 for action in atexit.unregister, lambda o: atexit._clear():
146 with self.subTest(action=action):
147 atexit.register(lambda: None)
148 atexit.unregister(Evil())
149 atexit._clear()
150
151 def test_eq_unregister(self):
152 # Issue #112127: callback's __eq__ may call unregister

Callers

nothing calls this directly

Calls 5

EvilClass · 0.70
_clearMethod · 0.45
subTestMethod · 0.45
registerMethod · 0.45
unregisterMethod · 0.45

Tested by

no test coverage detected