MCPcopy Create free account
hub / github.com/ipython/ipython / doctest_reset_del

Function doctest_reset_del

IPython/core/tests/test_run.py:146–161  ·  view source on GitHub ↗

Test that resetting doesn't cause errors in __del__ methods. In [2]: class A(object): ...: def __del__(self): ...: print(str("Hi")) ...: In [3]: a = A() In [4]: get_ipython().reset() Hi In [5]: 1+1 Out[5]: 2

()

Source from the content-addressed store, hash-verified

144
145
146def doctest_reset_del():
147 """Test that resetting doesn't cause errors in __del__ methods.
148
149 In [2]: class A(object):
150 ...: def __del__(self):
151 ...: print(str("Hi"))
152 ...:
153
154 In [3]: a = A()
155
156 In [4]: get_ipython().reset()
157 Hi
158
159 In [5]: 1+1
160 Out[5]: 2
161 """
162
163# For some tests, it will be handy to organize them in a class with a common
164# setup that makes a temp file

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected