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
8ebe27f3
Commit
8ebe27f3
authored
Dec 21, 2010
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deprecate assertDictContainsSubset()
parent
f2590767
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
4 deletions
+22
-4
Doc/library/unittest.rst
Doc/library/unittest.rst
+6
-3
Lib/unittest/case.py
Lib/unittest/case.py
+2
-0
Lib/unittest/test/test_case.py
Lib/unittest/test/test_case.py
+2
-1
Misc/NEWS
Misc/NEWS
+12
-0
No files found.
Doc/library/unittest.rst
View file @
8ebe27f3
...
...
@@ -1078,9 +1078,6 @@ Test cases
| :meth:`assertNotRegex(s, re) | ``not regex.search(s)`` | 3.2 |
| <TestCase.assertNotRegex>` | | |
+---------------------------------------+--------------------------------+--------------+
| :meth:`assertDictContainsSubset(a, b) | all the key/value pairs | 3.1 |
| <TestCase.assertDictContainsSubset>` | in `a` exist in `b` | |
+---------------------------------------+--------------------------------+--------------+
| :meth:`assertCountEqual(a, b) | `a` and `b` have the same | 3.2 |
| <TestCase.assertCountEqual>` | elements in the same number, | |
| | regardless of their order | |
...
...
@@ -1145,7 +1142,13 @@ Test cases
those in *subset*. If not, an error message listing the missing keys
and mismatched values is generated.
Note, the arguments are in the opposite order of what the method name
dictates. Instead, consider using the set-methods on :ref:`dictionary
views <dict-views>`, for example: ``d.keys() <= e.keys()`` or
``d.items() <= d.items()``.
.. versionadded:: 3.1
.. deprecated:: 3.2
.. method:: assertCountEqual(actual, expected, msg=None)
...
...
Lib/unittest/case.py
View file @
8ebe27f3
...
...
@@ -934,6 +934,8 @@ class TestCase(object):
def
assertDictContainsSubset
(
self
,
subset
,
dictionary
,
msg
=
None
):
"""Checks whether dictionary is a superset of subset."""
warnings
.
warn
(
'assertDictContainsSubset is deprecated'
,
DeprecationWarning
)
missing
=
[]
mismatched
=
[]
for
key
,
value
in
subset
.
items
():
...
...
Lib/unittest/test/test_case.py
View file @
8ebe27f3
...
...
@@ -1079,6 +1079,7 @@ test case
(
self
.
failUnlessRaises
,
(
TypeError
,
lambda
_
:
3.14
+
'spam'
)),
(
self
.
failIf
,
(
False
,)),
(
self
.
assertSameElements
,
([
1
,
1
,
2
,
3
],
[
1
,
2
,
3
])),
(
self
.
assertDictContainsSubset
,
(
dict
(
a
=
1
,
b
=
2
),
dict
(
a
=
1
,
b
=
2
,
c
=
3
))),
(
self
.
assertRaisesRegexp
,
(
KeyError
,
'foo'
,
lambda
:
{}[
'foo'
])),
(
self
.
assertRegexpMatches
,
(
'bar'
,
'bar'
)),
)
...
...
@@ -1093,7 +1094,7 @@ test case
deprecated_names
=
[
'failIfEqual'
,
'failUnlessEqual'
,
'failUnlessAlmostEqual'
,
'failIfAlmostEqual'
,
'failUnless'
,
'failUnlessRaises'
,
'failIf'
,
'assertSameElements'
'assertSameElements'
,
'assertDictContainsSubset'
,
]
for
deprecated_name
in
deprecated_names
:
with
self
.
assertRaises
(
AttributeError
):
...
...
Misc/NEWS
View file @
8ebe27f3
...
...
@@ -2,6 +2,18 @@
Python News
+++++++++++
What's New in Python 3.2 Release Candidate 1
============================================
Core and Builtins
-----------------
Library
-------
- Deprecated assertDictContainsSubclass() in the unittest module.
What's New in Python 3.2 Beta 2?
================================
...
...
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