[Python-checkins] r59900 - in python/trunk: Doc/library/collections.rst Lib/test/test_collections.py
raymond.hettinger
python-checkins at python.org
Fri Jan 11 01:23:13 CET 2008
Author: raymond.hettinger
Date: Fri Jan 11 01:23:13 2008
New Revision: 59900
Modified:
python/trunk/Doc/library/collections.rst
python/trunk/Lib/test/test_collections.py
Log:
Run doctests on the collections module
Modified: python/trunk/Doc/library/collections.rst
==============================================================================
--- python/trunk/Doc/library/collections.rst (original)
+++ python/trunk/Doc/library/collections.rst Fri Jan 11 01:23:13 2008
@@ -502,7 +502,7 @@
>>> 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)
Modified: python/trunk/Lib/test/test_collections.py
==============================================================================
--- python/trunk/Lib/test/test_collections.py (original)
+++ python/trunk/Lib/test/test_collections.py Fri Jan 11 01:23:13 2008
@@ -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 @@
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)
More information about the Python-checkins
mailing list