mirror of
https://github.com/django/django.git
synced 2025-12-04 00:55:36 +00:00
Marked bytestrings with b prefix. Refs #18269
This is a preparation for unicode literals general usage in Django (Python 3 compatibility).
This commit is contained in:
parent
822d6d6dab
commit
38408f8007
44 changed files with 296 additions and 295 deletions
|
|
@ -11,11 +11,11 @@ from .models import Article, InternationalArticle
|
|||
class SimpleTests(TestCase):
|
||||
def test_basic(self):
|
||||
a = Article.objects.create(
|
||||
headline='Area man programs in Python',
|
||||
headline=b'Area man programs in Python',
|
||||
pub_date=datetime.datetime(2005, 7, 28)
|
||||
)
|
||||
self.assertEqual(str(a), 'Area man programs in Python')
|
||||
self.assertEqual(repr(a), '<Article: Area man programs in Python>')
|
||||
self.assertEqual(str(a), b'Area man programs in Python')
|
||||
self.assertEqual(repr(a), b'<Article: Area man programs in Python>')
|
||||
|
||||
def test_international(self):
|
||||
a = InternationalArticle.objects.create(
|
||||
|
|
@ -23,4 +23,4 @@ class SimpleTests(TestCase):
|
|||
pub_date=datetime.datetime(2005, 7, 28)
|
||||
)
|
||||
# The default str() output will be the UTF-8 encoded output of __unicode__().
|
||||
self.assertEqual(str(a), 'Girl wins \xe2\x82\xac12.500 in lottery')
|
||||
self.assertEqual(str(a), b'Girl wins \xe2\x82\xac12.500 in lottery')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue