Run doctests on the collections module

This commit is contained in:
Raymond Hettinger 2008-01-11 00:23:13 +00:00
parent 15b5e55b48
commit d1ef85420f
2 changed files with 5 additions and 3 deletions

View 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)

View 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)