summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-01-11 00:23:13 +0000
committerRaymond Hettinger <python@rcn.com>2008-01-11 00:23:13 +0000
commitd1ef85420f80db51f7289265aa103dff746c6517 (patch)
treea21e97573a7a8ab25346291715118ea866c5c3ac
parent15b5e55b48dc9da1fdfdd4cb282da499c45da5fb (diff)
downloadcpython-git-d1ef85420f80db51f7289265aa103dff746c6517.tar.gz
Run doctests on the collections module
-rw-r--r--Doc/library/collections.rst2
-rw-r--r--Lib/test/test_collections.py6
2 files changed, 5 insertions, 3 deletions
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
index 6b02576d05..b10569b717 100644
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -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)
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index dd9982af3c..5a6387a779 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -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)