diff options
| author | Tim Graham <timograham@gmail.com> | 2016-09-16 12:15:00 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-09-17 15:44:06 -0400 |
| commit | 8119b679eb85cdc0ae3d321e54d06dd0200a1e82 (patch) | |
| tree | b4f4e40a371569a260a39ca310e8e984d8582d74 /tests/forms_tests | |
| parent | 17677d510f65012531a5af57fd056fb15cfe1067 (diff) | |
Refs #27025 -- Fixed "invalid escape sequence" warnings in Python 3.6.
http://bugs.python.org/issue27364
Diffstat (limited to 'tests/forms_tests')
4 files changed, 9 insertions, 9 deletions
diff --git a/tests/forms_tests/field_tests/test_filepathfield.py b/tests/forms_tests/field_tests/test_filepathfield.py index e747189c3e..5c4bd1bbb2 100644 --- a/tests/forms_tests/field_tests/test_filepathfield.py +++ b/tests/forms_tests/field_tests/test_filepathfield.py @@ -53,7 +53,7 @@ class FilePathFieldTest(SimpleTestCase): def test_filepathfield_3(self): path = upath(forms.__file__) path = os.path.dirname(os.path.abspath(path)) + '/' - f = FilePathField(path=path, match='^.*?\.py$') + f = FilePathField(path=path, match=r'^.*?\.py$') f.choices.sort() expected = [ ('/django/forms/__init__.py', '__init__.py'), @@ -72,7 +72,7 @@ class FilePathFieldTest(SimpleTestCase): def test_filepathfield_4(self): path = os.path.abspath(upath(forms.__file__)) path = os.path.dirname(path) + '/' - f = FilePathField(path=path, recursive=True, match='^.*?\.py$') + f = FilePathField(path=path, recursive=True, match=r'^.*?\.py$') f.choices.sort() expected = [ ('/django/forms/__init__.py', '__init__.py'), diff --git a/tests/forms_tests/field_tests/test_regexfield.py b/tests/forms_tests/field_tests/test_regexfield.py index ece958e509..c0e75438f6 100644 --- a/tests/forms_tests/field_tests/test_regexfield.py +++ b/tests/forms_tests/field_tests/test_regexfield.py @@ -48,8 +48,8 @@ class RegexFieldTest(SimpleTestCase): f.clean('123') six.assertRaisesRegex( self, ValidationError, - "'Ensure this value has at least 5 characters \(it has 3\)\.'," - " u?'Enter a valid value\.'", + r"'Ensure this value has at least 5 characters \(it has 3\)\.'," + r" u?'Enter a valid value\.'", f.clean, 'abc' ) self.assertEqual('12345', f.clean('12345')) @@ -60,7 +60,7 @@ class RegexFieldTest(SimpleTestCase): f.clean('12345a') def test_regexfield_unicode_characters(self): - f = RegexField('^\w+$') + f = RegexField(r'^\w+$') self.assertEqual('éèøçÎÎ你好', f.clean('éèøçÎÎ你好')) def test_change_regex_after_init(self): diff --git a/tests/forms_tests/field_tests/test_splitdatetimefield.py b/tests/forms_tests/field_tests/test_splitdatetimefield.py index 1febb57b28..e46eb163a8 100644 --- a/tests/forms_tests/field_tests/test_splitdatetimefield.py +++ b/tests/forms_tests/field_tests/test_splitdatetimefield.py @@ -23,7 +23,7 @@ class SplitDateTimeFieldTest(SimpleTestCase): f.clean('') with self.assertRaisesMessage(ValidationError, "'Enter a list of values.'"): f.clean('hello') - with six.assertRaisesRegex(self, ValidationError, "'Enter a valid date\.', u?'Enter a valid time\.'"): + with six.assertRaisesRegex(self, ValidationError, r"'Enter a valid date\.', u?'Enter a valid time\.'"): f.clean(['hello', 'there']) with self.assertRaisesMessage(ValidationError, "'Enter a valid time.'"): f.clean(['2006-01-10', 'there']) @@ -43,7 +43,7 @@ class SplitDateTimeFieldTest(SimpleTestCase): self.assertIsNone(f.clean(['', ''])) with self.assertRaisesMessage(ValidationError, "'Enter a list of values.'"): f.clean('hello') - with six.assertRaisesRegex(self, ValidationError, "'Enter a valid date\.', u?'Enter a valid time\.'"): + with six.assertRaisesRegex(self, ValidationError, r"'Enter a valid date\.', u?'Enter a valid time\.'"): f.clean(['hello', 'there']) with self.assertRaisesMessage(ValidationError, "'Enter a valid time.'"): f.clean(['2006-01-10', 'there']) diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py index f86ab2d43c..44034d310d 100644 --- a/tests/forms_tests/tests/test_forms.py +++ b/tests/forms_tests/tests/test_forms.py @@ -2914,7 +2914,7 @@ Good luck picking a username that doesn't already exist.</p> self.assertEqual('+61.287654321 ext. 123 (label: )', f.clean(['+61', '287654321', '123'])) six.assertRaisesRegex( self, ValidationError, - "'Enter a complete value\.', u?'Enter an extension\.'", f.clean, ['', '', '', 'Home'] + r"'Enter a complete value\.', u?'Enter an extension\.'", f.clean, ['', '', '', 'Home'] ) with self.assertRaisesMessage(ValidationError, "'Enter a valid country code.'"): f.clean(['61', '287654321', '123', 'Home']) @@ -2930,7 +2930,7 @@ Good luck picking a username that doesn't already exist.</p> self.assertEqual('+61.287654321 ext. 123 (label: )', f.clean(['+61', '287654321', '123'])) six.assertRaisesRegex( self, ValidationError, - "'Enter a complete value\.', u?'Enter an extension\.'", f.clean, ['', '', '', 'Home'] + r"'Enter a complete value\.', u?'Enter an extension\.'", f.clean, ['', '', '', 'Home'] ) with self.assertRaisesMessage(ValidationError, "'Enter a valid country code.'"): f.clean(['61', '287654321', '123', 'Home']) |
