Skip to content

Commit 4fdaf4d

Browse files
Fix doctests.
1 parent f74b4b2 commit 4fdaf4d

5 files changed

Lines changed: 8 additions & 8 deletions

File tree

Doc/howto/argparse.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ And this is what it gives:
555555
Traceback (most recent call last):
556556
File "prog.py", line 11, in <module>
557557
if args.verbosity >= 2:
558-
TypeError: '>=' not supported between instances of 'NoneType' and 'int'
558+
TypeError: '>=' not supported between instances of 'types.NoneType' and 'int'
559559
560560
561561
* First output went well, and fixes the bug we had before.

Doc/howto/descriptor.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,7 +1379,7 @@ and :attr:`~function.__doc__`.
13791379
'StaticMethod'
13801380
>>> f = E_sim.f
13811381
>>> type(f).__name__
1382-
'function'
1382+
'FunctionType'
13831383
>>> sm.__name__
13841384
'f'
13851385
>>> f.__name__
@@ -1523,7 +1523,7 @@ Using the non-data descriptor protocol, a pure Python version of
15231523
# Verify that __wrapped__ was added and works correctly
15241524
>>> f = vars(T)['cm'].__wrapped__
15251525
>>> type(f).__name__
1526-
'function'
1526+
'FunctionType'
15271527
>>> f.__name__
15281528
'cm'
15291529
>>> f(T, 11, 22)

Doc/library/doctest.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ Some details you should read once, but won't need to remember:
554554
File "<stdin>", line 1
555555
1 + None
556556
~~^~~~~~
557-
TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'
557+
TypeError: unsupported operand type(s) for +: 'int' and 'types.NoneType'
558558

559559
Since the lines showing the position of the error come before the exception type
560560
and detail, they are not checked by doctest. For example, the following test
@@ -564,7 +564,7 @@ Some details you should read once, but won't need to remember:
564564
File "<stdin>", line 1
565565
1 + None
566566
^~~~~~~~
567-
TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'
567+
TypeError: unsupported operand type(s) for +: 'int' and 'types.NoneType'
568568

569569

570570
.. _option-flags-and-directives:

Doc/library/re.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1681,7 +1681,7 @@ To find out what card the pair consists of, one could use the
16811681
Traceback (most recent call last):
16821682
File "<pyshell#23>", line 1, in <module>
16831683
pair_re.prefixmatch("718ak").group(1)
1684-
AttributeError: 'NoneType' object has no attribute 'group'
1684+
AttributeError: 'types.NoneType' object has no attribute 'group'
16851685

16861686
>>> pair_re.prefixmatch("354aa").group(1)
16871687
'a'

Doc/library/typing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,9 +1484,9 @@ These can be used as types in annotations. They all support subscription using
14841484
>>> def func(x: Annotated[int, "metadata"]) -> None: pass
14851485
...
14861486
>>> get_type_hints(func)
1487-
{'x': <class 'int'>, 'return': <class 'NoneType'>}
1487+
{'x': <class 'int'>, 'return': <class 'types.NoneType'>}
14881488
>>> get_type_hints(func, include_extras=True)
1489-
{'x': typing.Annotated[int, 'metadata'], 'return': <class 'NoneType'>}
1489+
{'x': typing.Annotated[int, 'metadata'], 'return': <class 'types.NoneType'>}
14901490

14911491
At runtime, the metadata associated with an ``Annotated`` type can be
14921492
retrieved via the :attr:`!__metadata__` attribute:

0 commit comments

Comments
 (0)