File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -942,6 +942,29 @@ def test_line_magics_with_code_argument(self):
942942 text , matches = c .complete ("%debug --invalid float.as_integer" )
943943 self .assertEqual (matches , [])
944944
945+ def test_line_magics_with_code_argument_shadowing (self ):
946+ ip = get_ipython ()
947+ c = ip .Completer
948+ c .use_jedi = False
949+
950+ # shadow
951+ ip .run_cell ("timeit = 1" )
952+
953+ # should not suggest on implict magic when shadowed
954+ text , matches = c .complete ("timeit -n 2 -r 1 flo" )
955+ self .assertEqual (matches , [])
956+
957+ # should suggest on explicit magic
958+ text , matches = c .complete ("%timeit -n 2 -r 1 flo" )
959+ self .assertEqual (matches , ["float" ])
960+
961+ # remove shadow
962+ del ip .user_ns ["timeit" ]
963+
964+ # should suggest on implicit magic after shadow removal
965+ text , matches = c .complete ("timeit -n 2 -r 1 flo" )
966+ self .assertEqual (matches , ["float" ])
967+
945968 def test_magic_completion_order (self ):
946969 ip = get_ipython ()
947970 c = ip .Completer
You can’t perform that action at this time.
0 commit comments