FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-45249: Add regression test for display of SyntaxError range indicator in doctests by akulakov · Pull Request #28567 · python/cpython · GitHub

/ cpython Public
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
16 changes: 16 additions & 0 deletions Lib/test/test_doctest3.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import unittest
import io
import contextlib
import doctest

class TestDoctest(unittest.TestCase):
def test_syntax_error(self):
f = io.StringIO()
with contextlib.redirect_stdout(f):
doctest.run_docstring_examples('>>> 1 1', globals())
self.assertIn('''
1 1
^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?''',
f.getvalue())

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Added regression test for caret indicators of :exc:`SyntaxError` errors
in :mod:`doctest`.

Back | FazBrowse Home | New Git URL