]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Run doctests on the collections module
authorRaymond Hettinger <python@rcn.com>
Fri, 11 Jan 2008 00:23:13 +0000 (00:23 +0000)
committerRaymond Hettinger <python@rcn.com>
Fri, 11 Jan 2008 00:23:13 +0000 (00:23 +0000)
Doc/library/collections.rst
Lib/test/test_collections.py

index 6b02576d05a5a9a09e426c9c0b334ca83e4daf08..b10569b7173b2fe36c3a809744d8cc8fdc1f5f56 100644 (file)
@@ -502,7 +502,7 @@ function::
     >>> getattr(p, 'x')
     11
 
-To cast a dictionary to a named tuple, use the double-star-operator [#]_::
+To convert a dictionary to a named tuple, use the double-star-operator [#]_::
 
    >>> d = {'x': 11, 'y': 22}
    >>> Point(**d)
index dd9982af3c29a95eff07c08452420cb32016a838..5a6387a7797c8da283a4ec5548ec007c29a2d549 100644 (file)
@@ -1,4 +1,4 @@
-import unittest
+import unittest, doctest
 from test import test_support
 from collections import namedtuple
 from collections import Hashable, Iterable, Iterator
@@ -304,10 +304,12 @@ class TestCollectionABCs(unittest.TestCase):
             self.failUnless(issubclass(sample, MutableSequence))
         self.failIf(issubclass(basestring, MutableSequence))
 
+import doctest, collections
+NamedTupleDocs = doctest.DocTestSuite(module=collections)
 
 def test_main(verbose=None):
     import collections as CollectionsModule
-    test_classes = [TestNamedTuple, TestOneTrickPonyABCs, TestCollectionABCs]
+    test_classes = [TestNamedTuple, NamedTupleDocs, TestOneTrickPonyABCs, TestCollectionABCs]
     test_support.run_unittest(*test_classes)
     test_support.run_doctest(CollectionsModule, verbose)