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

Method test_autoload3_normalimport_2

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

Source from the content-addressed store, hash-verified

498 self.shell.run_code(f"n")
499
500 def test_autoload3_normalimport_2(self):
501 self.shell.magic_autoreload("3")
502 mod_code = """
503 def func1(): pass
504 n = 1
505 """
506 mod_name, mod_fn = self.new_module(textwrap.dedent(mod_code))
507 self.shell.run_code(f"from {mod_name} import n")
508 with self.assertRaises(NameError):
509 self.shell.run_code("func1()")
510 self.shell.run_code("n")
511
512 new_code = """
513 n = 100
514 def func2(): pass
515 def func1(): pass
516 m = 5
517 """
518 self.shell.run_code(f"import {mod_name}")
519 self.write_file(mod_fn, textwrap.dedent(new_code))
520 self.shell.run_code(f"{mod_name}.func1()")
521 self.shell.run_code(f"{mod_name}.n")
522 self.shell.run_code(f"{mod_name}.func2()")
523 self.shell.run_code(f"{mod_name}.m")
524 self.shell.run_code(f"n")
525
526 def test_autoload_3_does_not_add_all(self):
527 # Tests that %autoreload 3 does not effectively run from X import *

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