diff options
author | Raymond Hettinger <python@rcn.com> | 2010-12-21 19:24:26 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2010-12-21 19:24:26 (GMT) |
commit | 8ebe27f30012ad1858edf41a0ee0be16ff70127b (patch) | |
tree | 62a28157f0bf2500e03870168a60dce71d3217a5 /Lib | |
parent | f259076790dac0b0c596a4545f05967d9cc76f65 (diff) | |
download | cpython-8ebe27f30012ad1858edf41a0ee0be16ff70127b.zip cpython-8ebe27f30012ad1858edf41a0ee0be16ff70127b.tar.gz cpython-8ebe27f30012ad1858edf41a0ee0be16ff70127b.tar.bz2 |
Deprecate assertDictContainsSubset()
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/unittest/case.py | 2 | ||||
-rw-r--r-- | Lib/unittest/test/test_case.py | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py index b02d475..15c7eee 100644 --- a/Lib/unittest/case.py +++ b/Lib/unittest/case.py @@ -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(): diff --git a/Lib/unittest/test/test_case.py b/Lib/unittest/test/test_case.py index 3ad883d..3376428 100644 --- a/Lib/unittest/test/test_case.py +++ b/Lib/unittest/test/test_case.py @@ -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): |