Skip to content

Commit 4050792

Browse files
committed
#16154: fix some doctests in Doc/library. Patch by Ravi Sinha.
1 parent 444d153 commit 4050792

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

Doc/library/colorsys.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ The :mod:`colorsys` module defines the following functions:
5858
Example::
5959

6060
>>> import colorsys
61-
>>> colorsys.rgb_to_hsv(.3, .4, .2)
62-
(0.25, 0.5, 0.4)
63-
>>> colorsys.hsv_to_rgb(0.25, 0.5, 0.4)
64-
(0.3, 0.4, 0.2)
61+
>>> colorsys.rgb_to_hsv(0.2, 0.4, 0.4)
62+
(0.5, 0.5, 0.4)
63+
>>> colorsys.hsv_to_rgb(0.5, 0.5, 0.4)
64+
(0.2, 0.4, 0.4)

Doc/library/filecmp.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ The :mod:`filecmp` module defines the following functions:
5454
Example::
5555

5656
>>> import filecmp
57-
>>> filecmp.cmp('undoc.rst', 'undoc.rst')
57+
>>> filecmp.cmp('undoc.rst', 'undoc.rst') # doctest: +SKIP
5858
True
59-
>>> filecmp.cmp('undoc.rst', 'index.rst')
59+
>>> filecmp.cmp('undoc.rst', 'index.rst') # doctest: +SKIP
6060
False
6161

6262

@@ -191,6 +191,6 @@ recursively through two directories to show common different files::
191191
... for sub_dcmp in dcmp.subdirs.values():
192192
... print_diff_files(sub_dcmp)
193193
...
194-
>>> dcmp = dircmp('dir1', 'dir2')
195-
>>> print_diff_files(dcmp)
194+
>>> dcmp = dircmp('dir1', 'dir2') # doctest: +SKIP
195+
>>> print_diff_files(dcmp) # doctest: +SKIP
196196

Doc/library/math.rst

+2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ Number-theoretic and representation functions
7777

7878

7979
.. function:: fsum(iterable)
80+
.. testsetup::
81+
>>> from math import fsum
8082

8183
Return an accurate floating point sum of values in the iterable. Avoids
8284
loss of precision by tracking multiple intermediate partial sums::

Doc/library/string.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ Nesting arguments and more complex examples::
610610
3232235521
611611
>>>
612612
>>> width = 5
613-
>>> for num in range(5,12):
613+
>>> for num in range(5,12): #doctest: +NORMALIZE_WHITESPACE
614614
... for base in 'dXob':
615615
... print('{0:{width}{base}}'.format(num, base=base, width=width), end=' ')
616616
... print()
@@ -698,7 +698,7 @@ Here is an example of how to use a Template:
698698
>>> Template('Give $who $100').substitute(d)
699699
Traceback (most recent call last):
700700
[...]
701-
ValueError: Invalid placeholder in string: line 1, col 10
701+
ValueError: Invalid placeholder in string: line 1, col 11
702702
>>> Template('$who likes $what').substitute(d)
703703
Traceback (most recent call last):
704704
[...]

Misc/ACKS

+1
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,7 @@ Michael Simcich
998998
Ionel Simionescu
999999
Kirill Simonov
10001000
Nathan Paul Simons
1001+
Ravi Sinha
10011002
Janne Sinkkonen
10021003
Ng Pheng Siong
10031004
George Sipe

0 commit comments

Comments
 (0)