diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-01-26 13:47:11 +0100 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-01-26 13:47:11 +0100 |
| commit | 55416e235d95b6168034236e5b1cdc581d544cc6 (patch) | |
| tree | b8916535102c084f4e6af0bc5038f7a7ea6f30a1 /tests | |
| parent | cebbec9b6122579a32a019a0449d4995dcf2191d (diff) | |
Fixed #19589 -- assertRegexpMatches is deprecated in Python 3.3.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/modeltests/timezones/tests.py | 2 | ||||
| -rw-r--r-- | tests/regressiontests/admin_views/tests.py | 2 | ||||
| -rw-r--r-- | tests/regressiontests/i18n/commands/extraction.py | 3 | ||||
| -rw-r--r-- | tests/regressiontests/version/tests.py | 3 |
4 files changed, 6 insertions, 4 deletions
diff --git a/tests/modeltests/timezones/tests.py b/tests/modeltests/timezones/tests.py index 29a490e3fb..4ae6bbd6a8 100644 --- a/tests/modeltests/timezones/tests.py +++ b/tests/modeltests/timezones/tests.py @@ -506,7 +506,7 @@ class SerializationTests(TestCase): def assert_yaml_contains_datetime(self, yaml, dt): # Depending on the yaml dumper, '!timestamp' might be absent - self.assertRegexpMatches(yaml, + six.assertRegex(self, yaml, r"- fields: {dt: !(!timestamp)? '%s'}" % re.escape(dt)) def test_naive_datetime(self): diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py index e886078ae5..d7d01e6a92 100644 --- a/tests/regressiontests/admin_views/tests.py +++ b/tests/regressiontests/admin_views/tests.py @@ -1263,7 +1263,7 @@ class AdminViewDeletedObjectsTest(TestCase): """ pattern = re.compile(br"""<li>Plot: <a href=".+/admin_views/plot/1/">World Domination</a>\s*<ul>\s*<li>Plot details: <a href=".+/admin_views/plotdetails/1/">almost finished</a>""") response = self.client.get('/test_admin/admin/admin_views/villain/%s/delete/' % quote(1)) - self.assertRegexpMatches(response.content, pattern) + six.assertRegex(self, response.content, pattern) def test_cyclic(self): """ diff --git a/tests/regressiontests/i18n/commands/extraction.py b/tests/regressiontests/i18n/commands/extraction.py index ef711ec1bb..ac8d8c1a09 100644 --- a/tests/regressiontests/i18n/commands/extraction.py +++ b/tests/regressiontests/i18n/commands/extraction.py @@ -9,6 +9,7 @@ from django.core import management from django.test import SimpleTestCase from django.utils.encoding import force_text from django.utils._os import upath +from django.utils import six from django.utils.six import StringIO @@ -112,7 +113,7 @@ class BasicExtractorTests(ExtractorTests): self.assertRaises(SyntaxError, management.call_command, 'makemessages', locale=LOCALE, extensions=['tpl'], verbosity=0) with self.assertRaises(SyntaxError) as context_manager: management.call_command('makemessages', locale=LOCALE, extensions=['tpl'], verbosity=0) - self.assertRegexpMatches(str(context_manager.exception), + six.assertRegex(self, str(context_manager.exception), r'Translation blocks must not include other block tags: blocktrans \(file templates[/\\]template_with_error\.tpl, line 3\)' ) # Check that the temporary file was cleaned up diff --git a/tests/regressiontests/version/tests.py b/tests/regressiontests/version/tests.py index 9b849ee4ba..64621a5cb6 100644 --- a/tests/regressiontests/version/tests.py +++ b/tests/regressiontests/version/tests.py @@ -1,6 +1,7 @@ import re from django import get_version +from django.utils import six from django.utils.unittest import TestCase class VersionTests(TestCase): @@ -10,7 +11,7 @@ class VersionTests(TestCase): # This will return a different result when it's run within or outside # of a git clone: 1.4.devYYYYMMDDHHMMSS or 1.4. ver_string = get_version(ver_tuple) - self.assertRegexpMatches(ver_string, r'1\.4(\.dev\d+)?') + six.assertRegex(self, ver_string, r'1\.4(\.dev\d+)?') def test_releases(self): tuples_to_strings = ( |
