summaryrefslogtreecommitdiff
path: root/tests/utils_tests/test_encoding.py
diff options
context:
space:
mode:
authorNick Pope <nick@nickpope.me.uk>2023-11-21 15:11:58 +0000
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-11-28 06:19:38 +0100
commitbaf705f34a8c8977d042ce43c71f508f9ca4f8ce (patch)
tree6ee650aea8ba19532955839fcb0c39a0705af7e1 /tests/utils_tests/test_encoding.py
parent051dbb53884eb202131c27dfdeac7c3ddd7b1072 (diff)
Refs #34986 -- Fixed some test assertions for PyPy.
These failures were due to minor inconsistencies or implementation differences between CPython and PyPy.
Diffstat (limited to 'tests/utils_tests/test_encoding.py')
-rw-r--r--tests/utils_tests/test_encoding.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/utils_tests/test_encoding.py b/tests/utils_tests/test_encoding.py
index 2b52b1607c..e0ee190431 100644
--- a/tests/utils_tests/test_encoding.py
+++ b/tests/utils_tests/test_encoding.py
@@ -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")