summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/case.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2022-06-26 07:18:06 (GMT)
committerGitHub <noreply@github.com>2022-06-26 07:18:06 (GMT)
commitc834c025695f598a0df3aba980257326a088044a (patch)
tree809a7f263324d9f15983e571d32e54fe6ebb8e0f /Lib/unittest/case.py
parent38612a05b5de33fde82d7960418527b7cfaa2e7c (diff)
downloadcpython-c834c025695f598a0df3aba980257326a088044a.zip
cpython-c834c025695f598a0df3aba980257326a088044a.tar.gz
cpython-c834c025695f598a0df3aba980257326a088044a.tar.bz2
Revert "bpo-45162: Revert "Remove many old deprecated unittest features"" (GH-92556)
This reverts commit b50322d20337ca468f2070eedb051a16ee1eba94.
Diffstat (limited to 'Lib/unittest/case.py')
-rw-r--r--Lib/unittest/case.py50
1 files changed, 0 insertions, 50 deletions
diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py
index ffc8f19..af83033 100644
--- a/Lib/unittest/case.py
+++ b/Lib/unittest/case.py
@@ -1171,35 +1171,6 @@ class TestCase(object):
standardMsg = self._truncateMessage(standardMsg, diff)
self.fail(self._formatMessage(msg, standardMsg))
- 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():
- if key not in dictionary:
- missing.append(key)
- elif value != dictionary[key]:
- mismatched.append('%s, expected: %s, actual: %s' %
- (safe_repr(key), safe_repr(value),
- safe_repr(dictionary[key])))
-
- if not (missing or mismatched):
- return
-
- standardMsg = ''
- if missing:
- standardMsg = 'Missing: %s' % ','.join(safe_repr(m) for m in
- missing)
- if mismatched:
- if standardMsg:
- standardMsg += '; '
- standardMsg += 'Mismatched values: %s' % ','.join(mismatched)
-
- self.fail(self._formatMessage(msg, standardMsg))
-
-
def assertCountEqual(self, first, second, msg=None):
"""Asserts that two iterables have the same elements, the same number of
times, without regard to order.
@@ -1363,27 +1334,6 @@ class TestCase(object):
raise self.failureException(msg)
- def _deprecate(original_func):
- def deprecated_func(*args, **kwargs):
- warnings.warn(
- 'Please use {0} instead.'.format(original_func.__name__),
- DeprecationWarning, 2)
- return original_func(*args, **kwargs)
- return deprecated_func
-
- # see #9424
- failUnlessEqual = assertEquals = _deprecate(assertEqual)
- failIfEqual = assertNotEquals = _deprecate(assertNotEqual)
- failUnlessAlmostEqual = assertAlmostEquals = _deprecate(assertAlmostEqual)
- failIfAlmostEqual = assertNotAlmostEquals = _deprecate(assertNotAlmostEqual)
- failUnless = assert_ = _deprecate(assertTrue)
- failUnlessRaises = _deprecate(assertRaises)
- failIf = _deprecate(assertFalse)
- assertRaisesRegexp = _deprecate(assertRaisesRegex)
- assertRegexpMatches = _deprecate(assertRegex)
- assertNotRegexpMatches = _deprecate(assertNotRegex)
-
-
class FunctionTestCase(TestCase):
"""A test case that wraps a test function.