From 405079213b7b35145ec5a437cd8b99528c3e4841 Mon Sep 17 00:00:00 2001 From: Ezio Melotti Date: Fri, 11 Jan 2013 09:09:07 +0200 Subject: #16154: fix some doctests in Doc/library. Patch by Ravi Sinha. --- Doc/library/colorsys.rst | 8 ++++---- Doc/library/filecmp.rst | 8 ++++---- Doc/library/math.rst | 2 ++ Doc/library/string.rst | 4 ++-- Misc/ACKS | 1 + 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Doc/library/colorsys.rst b/Doc/library/colorsys.rst index dbab706..225306c 100644 --- a/Doc/library/colorsys.rst +++ b/Doc/library/colorsys.rst @@ -58,7 +58,7 @@ The :mod:`colorsys` module defines the following functions: Example:: >>> import colorsys - >>> colorsys.rgb_to_hsv(.3, .4, .2) - (0.25, 0.5, 0.4) - >>> colorsys.hsv_to_rgb(0.25, 0.5, 0.4) - (0.3, 0.4, 0.2) + >>> colorsys.rgb_to_hsv(0.2, 0.4, 0.4) + (0.5, 0.5, 0.4) + >>> colorsys.hsv_to_rgb(0.5, 0.5, 0.4) + (0.2, 0.4, 0.4) diff --git a/Doc/library/filecmp.rst b/Doc/library/filecmp.rst index de20fb1..8fd23dd 100644 --- a/Doc/library/filecmp.rst +++ b/Doc/library/filecmp.rst @@ -54,9 +54,9 @@ The :mod:`filecmp` module defines the following functions: Example:: >>> import filecmp - >>> filecmp.cmp('undoc.rst', 'undoc.rst') + >>> filecmp.cmp('undoc.rst', 'undoc.rst') # doctest: +SKIP True - >>> filecmp.cmp('undoc.rst', 'index.rst') + >>> filecmp.cmp('undoc.rst', 'index.rst') # doctest: +SKIP False @@ -191,6 +191,6 @@ recursively through two directories to show common different files:: ... for sub_dcmp in dcmp.subdirs.values(): ... print_diff_files(sub_dcmp) ... - >>> dcmp = dircmp('dir1', 'dir2') - >>> print_diff_files(dcmp) + >>> dcmp = dircmp('dir1', 'dir2') # doctest: +SKIP + >>> print_diff_files(dcmp) # doctest: +SKIP diff --git a/Doc/library/math.rst b/Doc/library/math.rst index 98c5b33..5d6f951 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -77,6 +77,8 @@ Number-theoretic and representation functions .. function:: fsum(iterable) +.. testsetup:: + >>> from math import fsum Return an accurate floating point sum of values in the iterable. Avoids loss of precision by tracking multiple intermediate partial sums:: diff --git a/Doc/library/string.rst b/Doc/library/string.rst index d821339..5778980 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -610,7 +610,7 @@ Nesting arguments and more complex examples:: 3232235521 >>> >>> width = 5 - >>> for num in range(5,12): + >>> for num in range(5,12): #doctest: +NORMALIZE_WHITESPACE ... for base in 'dXob': ... print('{0:{width}{base}}'.format(num, base=base, width=width), end=' ') ... print() @@ -698,7 +698,7 @@ Here is an example of how to use a Template: >>> Template('Give $who $100').substitute(d) Traceback (most recent call last): [...] - ValueError: Invalid placeholder in string: line 1, col 10 + ValueError: Invalid placeholder in string: line 1, col 11 >>> Template('$who likes $what').substitute(d) Traceback (most recent call last): [...] diff --git a/Misc/ACKS b/Misc/ACKS index d6d81d5..3b8c7f2 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -998,6 +998,7 @@ Michael Simcich Ionel Simionescu Kirill Simonov Nathan Paul Simons +Ravi Sinha Janne Sinkkonen Ng Pheng Siong George Sipe -- cgit v0.12