(self)
| 979 | self.assertEqual(matches, ["%timeit", "%%timeit"]) |
| 980 | |
| 981 | def test_magic_completion_shadowing(self): |
| 982 | ip = get_ipython() |
| 983 | c = ip.Completer |
| 984 | c.use_jedi = False |
| 985 | |
| 986 | # Before importing matplotlib, %matplotlib magic should be the only option. |
| 987 | text, matches = c.complete("mat") |
| 988 | self.assertEqual(matches, ["%matplotlib"]) |
| 989 | |
| 990 | # The newly introduced name should shadow the magic. |
| 991 | ip.run_cell("matplotlib = 1") |
| 992 | text, matches = c.complete("mat") |
| 993 | self.assertEqual(matches, ["matplotlib"]) |
| 994 | |
| 995 | # After removing matplotlib from namespace, the magic should again be |
| 996 | # the only option. |
| 997 | del ip.user_ns["matplotlib"] |
| 998 | text, matches = c.complete("mat") |
| 999 | self.assertEqual(matches, ["%matplotlib"]) |
| 1000 | |
| 1001 | def test_magic_completion_shadowing_explicit(self): |
| 1002 | """ |
nothing calls this directly
no test coverage detected