1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

[1.5.x] Fixed #20237 -- Reenabled assertContains with binary parameter

Thanks Baptiste Mispelon for the review.
Backport of fe01404bb9 from master.
This commit is contained in:
Claude Paroz
2013-04-11 10:36:12 +02:00
parent 82b5e10e61
commit 427b59495e
4 changed files with 22 additions and 4 deletions

View File

@@ -131,6 +131,13 @@ class AssertContainsTests(TestCase):
self.assertNotContains(r, 'はたけ')
self.assertNotContains(r, b'\xe3\x81\xaf\xe3\x81\x9f\xe3\x81\x91'.decode('utf-8'))
def test_binary_contains(self):
r = self.client.get('/test_client_regress/check_binary/')
self.assertContains(r, b'PDF document')
with self.assertRaises(AssertionError):
self.assertContains(r, b'PDF document', count=2)
self.assertNotContains(r, b'ODF document')
def test_nontext_contains(self):
r = self.client.get('/test_client_regress/no_template_view/')
self.assertContains(r, ugettext_lazy('once'))