Show More
@@ -571,8 +571,12 b' class Inspector:' | |||||
571 | add_fields([('Repr', "string_form")]) |
|
571 | add_fields([('Repr', "string_form")]) | |
572 |
|
572 | |||
573 | elif info['ismagic']: |
|
573 | elif info['ismagic']: | |
574 | add_fields([("Docstring", "docstring"), |
|
574 | if detail_level > 0 and info['source'] is not None: | |
575 | ("File", "file") |
|
575 | add_fields([("Source", "source")]) | |
|
576 | else: | |||
|
577 | add_fields([("Docstring", "docstring")]) | |||
|
578 | ||||
|
579 | add_fields([("File", "file"), | |||
576 | ]) |
|
580 | ]) | |
577 |
|
581 | |||
578 | elif info['isclass'] or is_simple_callable(obj): |
|
582 | elif info['isclass'] or is_simple_callable(obj): |
@@ -28,6 +28,7 b' from IPython.core.magic import (Magics, magics_class, line_magic,' | |||||
28 | register_line_cell_magic) |
|
28 | register_line_cell_magic) | |
29 | from IPython.external.decorator import decorator |
|
29 | from IPython.external.decorator import decorator | |
30 | from IPython.testing.decorators import skipif |
|
30 | from IPython.testing.decorators import skipif | |
|
31 | from IPython.testing.tools import AssertPrints | |||
31 | from IPython.utils.path import compress_user |
|
32 | from IPython.utils.path import compress_user | |
32 | from IPython.utils import py3compat |
|
33 | from IPython.utils import py3compat | |
33 |
|
34 | |||
@@ -47,7 +48,7 b' ip = get_ipython()' | |||||
47 | # defined, if any code is inserted above, the following line will need to be |
|
48 | # defined, if any code is inserted above, the following line will need to be | |
48 | # updated. Do NOT insert any whitespace between the next line and the function |
|
49 | # updated. Do NOT insert any whitespace between the next line and the function | |
49 | # definition below. |
|
50 | # definition below. | |
50 |
THIS_LINE_NUMBER = 5 |
|
51 | THIS_LINE_NUMBER = 51 # Put here the actual number of this line | |
51 | def test_find_source_lines(): |
|
52 | def test_find_source_lines(): | |
52 | nt.assert_equal(oinspect.find_source_lines(test_find_source_lines), |
|
53 | nt.assert_equal(oinspect.find_source_lines(test_find_source_lines), | |
53 | THIS_LINE_NUMBER+1) |
|
54 | THIS_LINE_NUMBER+1) | |
@@ -372,3 +373,10 b' def test_pinfo_nonascii():' | |||||
372 | from . import nonascii2 |
|
373 | from . import nonascii2 | |
373 | ip.user_ns['nonascii2'] = nonascii2 |
|
374 | ip.user_ns['nonascii2'] = nonascii2 | |
374 | ip._inspect('pinfo', 'nonascii2', detail_level=1) |
|
375 | ip._inspect('pinfo', 'nonascii2', detail_level=1) | |
|
376 | ||||
|
377 | def test_pinfo_magic(): | |||
|
378 | with AssertPrints('Docstring:'): | |||
|
379 | ip._inspect('pinfo', 'lsmagic', detail_level=0) | |||
|
380 | ||||
|
381 | with AssertPrints('Source:'): | |||
|
382 | ip._inspect('pinfo', 'lsmagic', detail_level=1) |
General Comments 0
You need to be logged in to leave comments.
Login now