From a7f4a900c3a009bfc40b44096023110b632d3284 2022-10-04 21:49:04 From: Emilio Graff <1@emil.io> Date: 2022-10-04 21:49:04 Subject: [PATCH] Test for new parsing of `%aimport` --- diff --git a/IPython/extensions/tests/test_autoreload.py b/IPython/extensions/tests/test_autoreload.py index d384519..6c3e75a 100644 --- a/IPython/extensions/tests/test_autoreload.py +++ b/IPython/extensions/tests/test_autoreload.py @@ -419,6 +419,23 @@ class TestAutoreload(Fixture): with self.assertRaises(ValueError): self.shell.magic_autoreload('4') + def test_aimport_parsing(self): + # Modules can be included or excluded all in one line. + module_reloader = self.shell.auto_magics._reloader + self.shell.magic_aimport('os') # import and mark `os` for auto-reload. + assert module_reloader.modules['os'] is True + assert 'os' not in module_reloader.skip_modules.keys() + + self.shell.magic_aimport('-math') # forbid autoreloading of `math` + assert module_reloader.skip_modules['math'] is True + assert 'math' not in module_reloader.modules.keys() + + self.shell.magic_aimport('-os, math') # Can do this all in one line; wasn't possible before. + assert module_reloader.modules['math'] is True + assert 'math' not in module_reloader.skip_modules.keys() + assert module_reloader.skip_modules['os'] is True + assert 'os' not in module_reloader.modules.keys() + def _check_smoketest(self, use_aimport=True): """ Functional test for the automatic reloader using either