##// END OF EJS Templates
use capsys
M Bussonnier -
Show More
@@ -492,7 +492,7 b' def test_pinfo_docstring_if_detail_and_no_source():'
492 492 sys.version_info.releaselevel not in ("final", "candidate"),
493 493 reason="fails on 3.13.dev",
494 494 )
495 def test_pinfo_docstring_dynamic():
495 def test_pinfo_docstring_dynamic(capsys):
496 496 obj_def = """class Bar:
497 497 __custom_documentations__ = {
498 498 "prop" : "cdoc for prop",
@@ -513,20 +513,25 b' def test_pinfo_docstring_dynamic():'
513 513
514 514 ip.run_cell("b = Bar()")
515 515
516 with AssertPrints("Docstring: cdoc for prop"):
517 ip.run_line_magic("pinfo", "b.prop")
516 ip.run_line_magic("pinfo", "b.prop")
517 captured = capsys.readouterr()
518 assert "Docstring: cdoc for prop" in captured.out
518 519
519 with AssertPrints("Docstring: cdoc for non_exist"):
520 ip.run_line_magic("pinfo", "b.non_exist")
520 ip.run_line_magic("pinfo", "b.non_exist")
521 captured = capsys.readouterr()
522 assert "Docstring: cdoc for non_exist" in captured.out
521 523
522 with AssertPrints("Docstring: cdoc for prop"):
523 ip.run_cell("b.prop?")
524 ip.run_cell("b.prop?")
525 captured = capsys.readouterr()
526 assert "Docstring: cdoc for prop" in captured.out
524 527
525 with AssertPrints("Docstring: cdoc for non_exist"):
526 ip.run_cell("b.non_exist?")
528 ip.run_cell("b.non_exist?")
529 captured = capsys.readouterr()
530 assert "Docstring: cdoc for non_exist" in captured.out
527 531
528 with AssertPrints("Docstring: <no docstring>"):
529 ip.run_cell("b.undefined?")
532 ip.run_cell("b.undefined?")
533 captured = capsys.readouterr()
534 assert "Docstring: <no docstring>" in captured.out
530 535
531 536
532 537 def test_pinfo_magic():
General Comments 0
You need to be logged in to leave comments. Login now