summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/test/testcases.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/django/test/testcases.py b/django/test/testcases.py
index 550baf9137..794bc5039d 100644
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -12,6 +12,7 @@ from django.http import QueryDict
from django.test import _doctest as doctest
from django.test.client import Client
from django.utils import simplejson
+from django.utils.encoding import smart_str
normalize_long_ints = lambda s: re.sub(r'(?<![\w])(\d+)L(?![\w])', '\\1', s)
normalize_decimals = lambda s: re.sub(r"Decimal\('(\d+(\.\d*)?)'\)", lambda m: "Decimal(\"%s\")" % m.groups()[0], s)
@@ -330,6 +331,7 @@ class TransactionTestCase(unittest.TestCase):
self.assertEqual(response.status_code, status_code,
"Couldn't retrieve page: Response code was %d (expected %d)'" %
(response.status_code, status_code))
+ text = smart_str(text, response._charset)
real_count = response.content.count(text)
if count is not None:
self.assertEqual(real_count, count,
@@ -348,8 +350,9 @@ class TransactionTestCase(unittest.TestCase):
self.assertEqual(response.status_code, status_code,
"Couldn't retrieve page: Response code was %d (expected %d)'" %
(response.status_code, status_code))
- self.assertEqual(response.content.count(text), 0,
- "Response should not contain '%s'" % text)
+ text = smart_str(text, response._charset)
+ self.assertEqual(response.content.count(text),
+ 0, "Response should not contain '%s'" % text)
def assertFormError(self, response, form, field, errors):
"""