Refs #30241 -- Fixed BytesWarning emitted in test_translation tests.

This commit is contained in:
Jon Dufresne 2019-04-24 06:31:03 -07:00 committed by Mariusz Felisiak
parent 9141da1a80
commit 0a01ca80d7
2 changed files with 6 additions and 6 deletions

View File

@ -4,17 +4,17 @@ from django.utils.translation.trans_real import language_code_re
from . import Error, Tags, register
E001 = Error(
'You have provided an invalid value for the LANGUAGE_CODE setting: {}.',
'You have provided an invalid value for the LANGUAGE_CODE setting: {!r}.',
id='translation.E001',
)
E002 = Error(
'You have provided an invalid language code in the LANGUAGES setting: {}.',
'You have provided an invalid language code in the LANGUAGES setting: {!r}.',
id='translation.E002',
)
E003 = Error(
'You have provided an invalid language code in the LANGUAGES_BIDI setting: {}.',
'You have provided an invalid language code in the LANGUAGES_BIDI setting: {!r}.',
id='translation.E003',
)

View File

@ -42,7 +42,7 @@ class TranslationCheckTests(SimpleTestCase):
self.assertEqual(check_setting_language_code(None), [])
def test_invalid_language_code(self):
msg = 'You have provided an invalid value for the LANGUAGE_CODE setting: %s.'
msg = 'You have provided an invalid value for the LANGUAGE_CODE setting: %r.'
for tag in self.invalid_tags:
with self.subTest(tag), self.settings(LANGUAGE_CODE=tag):
self.assertEqual(check_setting_language_code(None), [
@ -55,7 +55,7 @@ class TranslationCheckTests(SimpleTestCase):
self.assertEqual(check_setting_languages(None), [])
def test_invalid_languages(self):
msg = 'You have provided an invalid language code in the LANGUAGES setting: %s.'
msg = 'You have provided an invalid language code in the LANGUAGES setting: %r.'
for tag in self.invalid_tags:
with self.subTest(tag), self.settings(LANGUAGES=[(tag, tag)]):
self.assertEqual(check_setting_languages(None), [
@ -68,7 +68,7 @@ class TranslationCheckTests(SimpleTestCase):
self.assertEqual(check_setting_languages_bidi(None), [])
def test_invalid_languages_bidi(self):
msg = 'You have provided an invalid language code in the LANGUAGES_BIDI setting: %s.'
msg = 'You have provided an invalid language code in the LANGUAGES_BIDI setting: %r.'
for tag in self.invalid_tags:
with self.subTest(tag), self.settings(LANGUAGES_BIDI=[tag]):
self.assertEqual(check_setting_languages_bidi(None), [