mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
Refs #34986 -- Fixed some test assertions for PyPy.
These failures were due to minor inconsistencies or implementation differences between CPython and PyPy.
This commit is contained in:
parent
051dbb5388
commit
baf705f34a
5 changed files with 17 additions and 6 deletions
|
@ -22,6 +22,7 @@ from django.utils.encoding import (
|
|||
)
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
from django.utils.translation import gettext_lazy
|
||||
from django.utils.version import PYPY
|
||||
|
||||
|
||||
class TestEncodingUtils(SimpleTestCase):
|
||||
|
@ -43,9 +44,10 @@ class TestEncodingUtils(SimpleTestCase):
|
|||
self.assertIs(type(force_str(s)), str)
|
||||
|
||||
def test_force_str_DjangoUnicodeDecodeError(self):
|
||||
reason = "unexpected end of data" if PYPY else "invalid start byte"
|
||||
msg = (
|
||||
"'utf-8' codec can't decode byte 0xff in position 0: invalid "
|
||||
"start byte. You passed in b'\\xff' (<class 'bytes'>)"
|
||||
f"'utf-8' codec can't decode byte 0xff in position 0: {reason}. "
|
||||
"You passed in b'\\xff' (<class 'bytes'>)"
|
||||
)
|
||||
with self.assertRaisesMessage(DjangoUnicodeDecodeError, msg):
|
||||
force_str(b"\xff")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue