Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
064aeb0e
Commit
064aeb0e
authored
Jan 11, 2008
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run doctests on the collections module
parent
22833bf2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
Doc/library/collections.rst
Doc/library/collections.rst
+1
-1
Lib/test/test_collections.py
Lib/test/test_collections.py
+4
-2
No files found.
Doc/library/collections.rst
View file @
064aeb0e
...
...
@@ -502,7 +502,7 @@ function::
>>> getattr(p, 'x')
11
To c
as
t a dictionary to a named tuple, use the double-star-operator [#]_::
To c
onver
t a dictionary to a named tuple, use the double-star-operator [#]_::
>>> d = {'x': 11, 'y': 22}
>>> Point(**d)
...
...
Lib/test/test_collections.py
View file @
064aeb0e
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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment