diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2014-05-17 14:56:40 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2014-05-17 14:56:40 -0400 |
commit | f5c6fd96beb04ccd7a86817ad5be1163f8409420 (patch) | |
tree | 063c9c92cc1ec679c323b310e8e2379fed34e469 /tests/backunittest.py | |
parent | b52c96fe479e4b30d19dd6be62a032791ac20ba3 (diff) | |
download | python-coveragepy-git-f5c6fd96beb04ccd7a86817ad5be1163f8409420.tar.gz |
Avoid a bunch of deprecated functions.
Diffstat (limited to 'tests/backunittest.py')
-rw-r--r-- | tests/backunittest.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/tests/backunittest.py b/tests/backunittest.py index ca741d37..a4377b0b 100644 --- a/tests/backunittest.py +++ b/tests/backunittest.py @@ -20,7 +20,21 @@ class TestCase(unittest.TestCase): `unittest` doesn't have them. """ - if _need('assertSameElements'): - def assertSameElements(self, s1, s2): - """Assert that the two arguments are equal as sets.""" - self.assertEqual(set(s1), set(s2)) + if _need('assertCountEqual'): + try: + assertCountEqual = assertSameElements + except NameError: + def assertCountEqual(self, s1, s2): + """Assert these have the same elements, regardless of order.""" + self.assertEqual(set(s1), set(s2)) + else: + def assertCountEqual(self, *args, **kwargs): + return self.assertSameElements(*args, **kwargs) + + if _need('assertRaisesRegex'): + def assertRaisesRegex(self, *args, **kwargs): + return self.assertRaisesRegexp(*args, **kwargs) + + if _need('assertRegex'): + def assertRegex(self, *args, **kwargs): + return self.assertRegexpMatches(*args, **kwargs) |