mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Refs #27025 -- Fixed "invalid escape sequence" warnings in Python 3.6.
http://bugs.python.org/issue27364
This commit is contained in:
parent
17677d510f
commit
8119b679eb
42 changed files with 82 additions and 82 deletions
|
@ -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'),
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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'])
|
||||
|
|
|
@ -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'])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue