diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2014-06-07 15:03:33 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2014-06-07 15:04:06 +0200 |
| commit | d98cc41a845237edd62013e3156a0991dfb3d93e (patch) | |
| tree | 40f03e940613029ca962d44122ba4eec893be6a0 /django | |
| parent | 11284a63d48c84f1d60b5686d55cf8a9f8d64422 (diff) | |
Made a test compatible with Python 2 and 3.
Diffstat (limited to 'django')
| -rw-r--r-- | django/utils/six.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/django/utils/six.py b/django/utils/six.py index bf94a83000..eb32ab8834 100644 --- a/django/utils/six.py +++ b/django/utils/six.py @@ -663,10 +663,12 @@ def add_metaclass(metaclass): ### Additional customizations for Django ### if PY3: + _assertCountEqual = "assertCountEqual" _assertRaisesRegex = "assertRaisesRegex" _assertRegex = "assertRegex" memoryview = memoryview else: + _assertCountEqual = "assertItemsEqual" _assertRaisesRegex = "assertRaisesRegexp" _assertRegex = "assertRegexpMatches" # memoryview and buffer are not strictly equivalent, but should be fine for @@ -678,6 +680,10 @@ else: memoryview = buffer +def assertCountEqual(self, *args, **kwargs): + return getattr(self, _assertCountEqual)(*args, **kwargs) + + def assertRaisesRegex(self, *args, **kwargs): return getattr(self, _assertRaisesRegex)(*args, **kwargs) |
