diff -r ed807b5fa10f 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) |
… |
… |
|
330 | 331 | self.assertEqual(response.status_code, status_code, |
331 | 332 | "Couldn't retrieve page: Response code was %d (expected %d)'" % |
332 | 333 | (response.status_code, status_code)) |
| 334 | text = smart_str(text, response._charset) |
333 | 335 | real_count = response.content.count(text) |
334 | 336 | if count is not None: |
335 | 337 | self.assertEqual(real_count, count, |
… |
… |
|
348 | 350 | self.assertEqual(response.status_code, status_code, |
349 | 351 | "Couldn't retrieve page: Response code was %d (expected %d)'" % |
350 | 352 | (response.status_code, status_code)) |
351 | | self.assertEqual(response.content.count(text), 0, |
352 | | "Response should not contain '%s'" % text) |
| 353 | text = smart_str(text, response._charset) |
| 354 | self.assertEqual(response.content.count(text), |
| 355 | 0, "Response should not contain '%s'" % text) |
353 | 356 | |
354 | 357 | def assertFormError(self, response, form, field, errors): |
355 | 358 | """ |