]> granicus.if.org Git - python/commitdiff
#16154: fix some doctests in Doc/library. Patch by Ravi Sinha.
authorEzio Melotti <ezio.melotti@gmail.com>
Fri, 11 Jan 2013 07:09:07 +0000 (09:09 +0200)
committerEzio Melotti <ezio.melotti@gmail.com>
Fri, 11 Jan 2013 07:09:07 +0000 (09:09 +0200)
Doc/library/colorsys.rst
Doc/library/filecmp.rst
Doc/library/math.rst
Doc/library/string.rst
Misc/ACKS

index dbab7063e106fbda0e19f0b2d2d689ab9d217285..225306c2d3a6b6e8ed28a00a631b0374e110c39c 100644 (file)
@@ -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)
index de20fb134a14e99338b096439ca10a472803c888..8fd23dd9de0bfc5b3d5bea2490232772fd35e05e 100644 (file)
@@ -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
 
index 98c5b334fc3093b4129a12875baa3d747fe8c800..5d6f951a1c00529edb59637dab938f9e668ec76d 100644 (file)
@@ -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::
index d821339f40ae5b31b5c178a21eb3b3f6db30a4ca..5778980fee154925212fbd4a9d4a6c0732f1236a 100644 (file)
@@ -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):
    [...]
index d6d81d5cad4f449b465a7cc7cd3edd96302f8e7b..3b8c7f29502688ab874a21e7316b2a5c519fc280 100644 (file)
--- 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