» ./python.exe -m doctest Doc/library/typing.rst
**********************************************************************
File "Doc/library/typing.rst", line 1959, in typing.rst
Failed example:
get_origin(P.args) is P
Exception raised:
Traceback (most recent call last):
File "/Users/sobolev/Desktop/cpython2/Lib/doctest.py", line 1374, in __run
exec(compile(example.source, filename, "single",
File "<doctest typing.rst[15]>", line 1, in<module>
get_origin(P.args) is P
^^^^^^^^^^NameError: name 'get_origin'isnot defined
**********************************************************************
File "Doc/library/typing.rst", line 1961, in typing.rst
Failed example:
get_origin(P.kwargs) is P
Exception raised:
Traceback (most recent call last):
File "/Users/sobolev/Desktop/cpython2/Lib/doctest.py", line 1374, in __run
exec(compile(example.source, filename, "single",
File "<doctest typing.rst[16]>", line 1, in<module>
get_origin(P.kwargs) is P
^^^^^^^^^^NameError: name 'get_origin'isnot defined
**********************************************************************
1 items had failures:
2 of 47 in typing.rst
***Test Failed*** 2 failures.
My proposal is too:
Fix it
Add a test to test_typing to ensure that doctests pass
The doctests in typing.rst aren't designed to be run via python -m doctest. They're designed to be run via Sphinx; we have special directives like this, which instruct Sphinx to run blocks of code prior to every doctest, but which wouldn't have any impact if you just ran the doctests via python -m doctest:
Activity
pythongh-111681: Fix doctests in `typing.rst` and run it in CI
AlexWaygood commented on Nov 3, 2023
The doctests in typing.rst aren't designed to be run via python -m doctest. They're designed to be run via Sphinx; we have special directives like this, which instruct Sphinx to run blocks of code prior to every doctest, but which wouldn't have any impact if you just ran the doctests via python -m doctest:
cpython/Doc/library/typing.rst
Lines 5 to 9 in d49aba5
gh-111681: minor fixes to typing doctests; remove unused imports in `…
pythongh-111681: minor fixes to typing doctests; remove unused import…
[3.11] pythongh-111681: minor fix to a typing doctest (python#111682)
[3.11] gh-111681: minor fix to a typing doctest (#111682) (#112037)
[3.12] gh-111681: minor fixes to typing doctests; remove unused impor…
pythongh-111681: minor fixes to typing doctests; remove unused import…
pythongh-111681: minor fixes to typing doctests; remove unused import…