Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Lib/unittest/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,8 @@ def assertDictEqual(self, d1, d2, msg=None):
def assertDictContainsSubset(self, subset, dictionary, msg=None):
"""Checks whether dictionary is a superset of subset."""
warnings.warn('assertDictContainsSubset is deprecated',
Comment thread
asottile marked this conversation as resolved.
Outdated
DeprecationWarning)
DeprecationWarning,
stacklevel=2)
missing = []
mismatched = []
for key, value in subset.items():
Expand Down
4 changes: 4 additions & 0 deletions Lib/unittest/test/test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,10 @@ def testAssertDictContainsSubset(self):
with self.assertRaises(self.failureException):
self.assertDictContainsSubset({'foo': one}, {'foo': '\uFFFD'})

with self.assertWarns(DeprecationWarning) as warninfo:
self.assertDictContainsSubset({}, {})
self.assertEqual(warninfo.warnings[0].filename, __file__)

def testAssertEqual(self):
equal_pairs = [
((), ()),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Ensure deprecation warning from :func:`assertDictContainsSubset` points at
calling code - by Anthony Sottile.