Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix doctest
  • Loading branch information
gaogaotiantian committed May 4, 2024
commit a1fc073b81dbee768c92945768048bec001799c1
14 changes: 10 additions & 4 deletions Lib/test/test_doctest/test_doctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2056,8 +2056,7 @@ def test_pdb_set_trace():

>>> try: runner.run(test)
... finally: sys.stdin = real_stdin
--Return--
> <doctest foo-bar@baz[2]>(1)<module>()->None
> <doctest foo-bar@baz[2]>(1)<module>()
-> import pdb; pdb.set_trace()
(Pdb) print(x)
42
Expand Down Expand Up @@ -2087,8 +2086,7 @@ def test_pdb_set_trace():
... runner.run(test)
... finally:
... sys.stdin = real_stdin
--Return--
> <doctest test.test_doctest.test_doctest.test_pdb_set_trace[9]>(3)calls_set_trace()->None
> <doctest test.test_doctest.test_doctest.test_pdb_set_trace[9]>(3)calls_set_trace()
-> import pdb; pdb.set_trace()
(Pdb) print(y)
2
Expand All @@ -2114,6 +2112,7 @@ def test_pdb_set_trace():
>>> test = parser.get_doctest(doc, globals(), "foo-bar@baz", "[email protected]", 0)
>>> real_stdin = sys.stdin
>>> sys.stdin = FakeInput([
... 'step', # return event of g
... 'list', # list source from example 2
... 'next', # return from g()
... 'list', # list source from example 1
Expand All @@ -2124,6 +2123,9 @@ def test_pdb_set_trace():
>>> try: runner.run(test)
... finally: sys.stdin = real_stdin
... # doctest: +NORMALIZE_WHITESPACE
> <doctest foo-bar@baz[1]>(3)g()
-> import pdb; pdb.set_trace()
(Pdb) step
--Return--
> <doctest foo-bar@baz[1]>(3)g()->None
-> import pdb; pdb.set_trace()
Expand Down Expand Up @@ -2188,6 +2190,7 @@ def test_pdb_set_trace_nested():
>>> test = parser.get_doctest(doc, globals(), "foo-bar@baz", "[email protected]", 0)
>>> real_stdin = sys.stdin
>>> sys.stdin = FakeInput([
... 'step',
... 'print(y)', # print data defined in the function
... 'step', 'step', 'step', 'step', 'step', 'step', 'print(z)',
... 'up', 'print(x)',
Expand All @@ -2201,6 +2204,9 @@ def test_pdb_set_trace_nested():
... finally:
... sys.stdin = real_stdin
... # doctest: +REPORT_NDIFF
> <doctest test.test_doctest.test_doctest.test_pdb_set_trace_nested[0]>(4)calls_set_trace()
-> import pdb; pdb.set_trace()
(Pdb) step
> <doctest test.test_doctest.test_doctest.test_pdb_set_trace_nested[0]>(5)calls_set_trace()
-> self.f1()
(Pdb) print(y)
Expand Down