Show More
@@ -662,3 +662,35 b' def test_script_defaults():' | |||||
662 | pass |
|
662 | pass | |
663 | else: |
|
663 | else: | |
664 | nt.assert_in(cmd, ip.magics_manager.magics['cell']) |
|
664 | nt.assert_in(cmd, ip.magics_manager.magics['cell']) | |
|
665 | ||||
|
666 | ||||
|
667 | @magics_class | |||
|
668 | class FooFoo(Magics): | |||
|
669 | """class with both %foo and %%foo magics""" | |||
|
670 | @line_magic('foo') | |||
|
671 | def line_foo(self, line): | |||
|
672 | "I am line foo" | |||
|
673 | pass | |||
|
674 | ||||
|
675 | @cell_magic("foo") | |||
|
676 | def cell_foo(self, line, cell): | |||
|
677 | "I am cell foo, not line foo" | |||
|
678 | pass | |||
|
679 | ||||
|
680 | def test_line_cell_info(): | |||
|
681 | """%%foo and %foo magics are distinguishable to inspect""" | |||
|
682 | ip = get_ipython() | |||
|
683 | ip.magics_manager.register(FooFoo) | |||
|
684 | oinfo = ip.object_inspect('foo') | |||
|
685 | nt.assert_true(oinfo['found']) | |||
|
686 | nt.assert_true(oinfo['ismagic']) | |||
|
687 | ||||
|
688 | oinfo = ip.object_inspect('%%foo') | |||
|
689 | nt.assert_true(oinfo['found']) | |||
|
690 | nt.assert_true(oinfo['ismagic']) | |||
|
691 | nt.assert_equals(oinfo['docstring'], FooFoo.cell_foo.__doc__) | |||
|
692 | ||||
|
693 | oinfo = ip.object_inspect('%foo') | |||
|
694 | nt.assert_true(oinfo['found']) | |||
|
695 | nt.assert_true(oinfo['ismagic']) | |||
|
696 | nt.assert_equals(oinfo['docstring'], FooFoo.line_foo.__doc__) |
General Comments 0
You need to be logged in to leave comments.
Login now