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

Method test_autoload3_normalimport

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

Source from the content-addressed store, hash-verified

470 self.shell.run_code(f"assert foo == 45")
471
472 def test_autoload3_normalimport(self):
473 self.shell.magic_autoreload("3")
474 mod_code = """
475 def func1(): pass
476 n = 1
477 """
478 mod_name, mod_fn = self.new_module(textwrap.dedent(mod_code))
479 self.shell.run_code(f"import {mod_name}")
480 self.shell.run_code(f"{mod_name}.func1()")
481 self.shell.run_code(f"{mod_name}.n")
482
483 new_code = """
484 n = 100
485 def func2(): pass
486 def func1(): pass
487 m = 5
488 """
489 self.write_file(mod_fn, textwrap.dedent(new_code))
490
491 self.shell.run_code(f"{mod_name}.func1()")
492 self.shell.run_code(f"{mod_name}.n")
493 self.shell.run_code(f"{mod_name}.func2()")
494 self.shell.run_code(f"{mod_name}.m")
495
496 self.shell.run_code(f"from {mod_name} import n")
497 self.shell.run_code(f"{mod_name}.func1()")
498 self.shell.run_code(f"n")
499
500 def test_autoload3_normalimport_2(self):
501 self.shell.magic_autoreload("3")

Callers

nothing calls this directly

Calls 4

magic_autoreloadMethod · 0.45
new_moduleMethod · 0.45
run_codeMethod · 0.45
write_fileMethod · 0.45

Tested by

no test coverage detected