Show More
@@ -362,3 +362,31 b' def test_line_cell_magics():' | |||||
362 | nt.assert_not_in('%_bar_cellm', matches) |
|
362 | nt.assert_not_in('%_bar_cellm', matches) | |
363 | nt.assert_in('%%_bar_cellm', matches) |
|
363 | nt.assert_in('%%_bar_cellm', matches) | |
364 |
|
364 | |||
|
365 | ||||
|
366 | def test_magic_completion_order(): | |||
|
367 | ||||
|
368 | ip = get_ipython() | |||
|
369 | c = ip.Completer | |||
|
370 | ||||
|
371 | # Test ordering of magics and non-magics with the same name | |||
|
372 | # We want the non-magic first | |||
|
373 | ||||
|
374 | # Before importing matplotlib, there should only be one option: | |||
|
375 | ||||
|
376 | text, matches = c.complete('mat') | |||
|
377 | nt.assert_equal(matches, ["%matplotlib"]) | |||
|
378 | ||||
|
379 | ||||
|
380 | ip.run_cell("matplotlib = 1") # introduce name into namespace | |||
|
381 | ||||
|
382 | # After the import, there should be two options, ordered like this: | |||
|
383 | text, matches = c.complete('mat') | |||
|
384 | nt.assert_equal(matches, ["matplotlib", "%matplotlib"]) | |||
|
385 | ||||
|
386 | ||||
|
387 | ip.run_cell("timeit = 1") # define a user variable called 'timeit' | |||
|
388 | ||||
|
389 | # Order of user variable and line and cell magics with same name: | |||
|
390 | text, matches = c.complete('timeit') | |||
|
391 | nt.assert_equal(matches, ["timeit", "%timeit","%%timeit"]) | |||
|
392 |
General Comments 0
You need to be logged in to leave comments.
Login now