Show More
@@ -384,6 +384,31 b' def test_pinfo_no_docstring_if_source():' | |||||
384 | ip._inspect('pinfo', 'foo', detail_level=1) |
|
384 | ip._inspect('pinfo', 'foo', detail_level=1) | |
385 |
|
385 | |||
386 |
|
386 | |||
|
387 | def test_pinfo_docstring_if_detail_and_no_source(): | |||
|
388 | """ Docstring should be displayed if source info not available """ | |||
|
389 | obj_def = '''class Foo(object): | |||
|
390 | """ This is a docstring for Foo """ | |||
|
391 | def bar(self): | |||
|
392 | """ This is a docstring for Foo.bar """ | |||
|
393 | pass | |||
|
394 | ''' | |||
|
395 | ||||
|
396 | ip.run_cell(obj_def) | |||
|
397 | ip.run_cell('foo = Foo()') | |||
|
398 | ||||
|
399 | with AssertNotPrints("Source:"): | |||
|
400 | with AssertPrints('Docstring:'): | |||
|
401 | ip._inspect('pinfo', 'foo', detail_level=0) | |||
|
402 | with AssertPrints('Docstring:'): | |||
|
403 | ip._inspect('pinfo', 'foo', detail_level=1) | |||
|
404 | with AssertPrints('Docstring:'): | |||
|
405 | ip._inspect('pinfo', 'foo.bar', detail_level=0) | |||
|
406 | ||||
|
407 | with AssertNotPrints('Docstring:'): | |||
|
408 | with AssertPrints('Source:'): | |||
|
409 | ip._inspect('pinfo', 'foo.bar', detail_level=1) | |||
|
410 | ||||
|
411 | ||||
387 | def test_pinfo_magic(): |
|
412 | def test_pinfo_magic(): | |
388 | with AssertPrints('Docstring:'): |
|
413 | with AssertPrints('Docstring:'): | |
389 | ip._inspect('pinfo', 'lsmagic', detail_level=0) |
|
414 | ip._inspect('pinfo', 'lsmagic', detail_level=0) |
General Comments 0
You need to be logged in to leave comments.
Login now