MCPcopy Index your code
hub / github.com/ipython/ipython / test_reload_enums

Method test_reload_enums

tests/test_zzz_autoreload.py:178–206  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

176
177class TestAutoreload(Fixture):
178 def test_reload_enums(self):
179 mod_name, mod_fn = self.new_module(
180 textwrap.dedent(
181 """
182 from enum import Enum
183 class MyEnum(Enum):
184 A = 'A'
185 B = 'B'
186 """
187 )
188 )
189 self.shell.magic_autoreload("2")
190 self.shell.magic_aimport(mod_name)
191 self.write_file(
192 mod_fn,
193 textwrap.dedent(
194 """
195 from enum import Enum
196 class MyEnum(Enum):
197 A = 'A'
198 B = 'B'
199 C = 'C'
200 """
201 ),
202 )
203 with tt.AssertNotPrints(
204 ("[autoreload of %s failed:" % mod_name), channel="stderr"
205 ):
206 self.shell.run_code("pass") # trigger another reload
207
208 def test_reload_class_type(self):
209 self.shell.magic_autoreload("2")

Callers

nothing calls this directly

Calls 5

magic_aimportMethod · 0.80
new_moduleMethod · 0.45
magic_autoreloadMethod · 0.45
write_fileMethod · 0.45
run_codeMethod · 0.45

Tested by

no test coverage detected