diff --git a/IPython/extensions/tests/test_autoreload.py b/IPython/extensions/tests/test_autoreload.py index 8cc55e7..db64a51 100644 --- a/IPython/extensions/tests/test_autoreload.py +++ b/IPython/extensions/tests/test_autoreload.py @@ -274,6 +274,39 @@ class TestAutoreload(Fixture): with self.assertRaises(AttributeError): self.shell.run_code(f"{object_name}.toto") + def test_comparing_numpy_structures(self): + self.shell.magic_autoreload("2") + mod_name, mod_fn = self.new_module( + textwrap.dedent( + """ + import numpy as np + class MyClass: + a = (np.array((.1, .2)), + np.array((.2, .3))) + """ + ) + ) + self.shell.run_code("from %s import MyClass" % mod_name) + self.shell.run_code("first = MyClass()") + + # change property `a` + self.write_file( + mod_fn, + textwrap.dedent( + """ + import numpy as np + class MyClass: + a = (np.array((.3, .4)), + np.array((.5, .6))) + """ + ), + ) + + with tt.AssertNotPrints( + ("[autoreload of %s failed:" % mod_name), channel="stderr" + ): + self.shell.run_code("pass") # trigger another reload + def test_autoload_newly_added_objects(self): self.shell.magic_autoreload("3") mod_code = """