diff -r c652d05460a8 django/test/testcases.py
a
|
b
|
|
12 | 12 | from django.test import _doctest as doctest |
13 | 13 | from django.test.client import Client |
14 | 14 | from django.utils import simplejson |
| 15 | from django.utils.encoding import smart_str |
15 | 16 | |
16 | 17 | normalize_long_ints = lambda s: re.sub(r'(?<![\w])(\d+)L(?![\w])', '\\1', s) |
17 | 18 | normalize_decimals = lambda s: re.sub(r"Decimal\('(\d+(\.\d*)?)'\)", lambda m: "Decimal(\"%s\")" % m.groups()[0], s) |
… |
… |
|
307 | 308 | self.assertEqual(response.status_code, status_code, |
308 | 309 | "Couldn't retrieve page: Response code was %d (expected %d)'" % |
309 | 310 | (response.status_code, status_code)) |
310 | | real_count = response.content.count(text) |
| 311 | real_count = response.content.count(smart_str(text, response._charset)) |
311 | 312 | if count is not None: |
312 | 313 | self.assertEqual(real_count, count, |
313 | 314 | "Found %d instances of '%s' in response (expected %d)" % |
… |
… |
|
325 | 326 | self.assertEqual(response.status_code, status_code, |
326 | 327 | "Couldn't retrieve page: Response code was %d (expected %d)'" % |
327 | 328 | (response.status_code, status_code)) |
328 | | self.assertEqual(response.content.count(text), 0, |
329 | | "Response should not contain '%s'" % text) |
| 329 | self.assertEqual(response.content.count(smart_str(text, response._charset)), |
| 330 | 0, "Response should not contain '%s'" % text) |
330 | 331 | |
331 | 332 | def assertFormError(self, response, form, field, errors): |
332 | 333 | """ |