#10183: assertContains fails when there is unicode in the response content -------------------------------+-------------------------------------------- Reporter: drakonen | Owner: nobody Status: new | Milestone: post-1.0 Component: Testing framework | Version: 1.0 Keywords: | Stage: Unreviewed Has_patch: 1 | -------------------------------+-------------------------------------------- {{{ # views.py #
from django.shortcuts import render_to_response def index(request): return render_to_response('index.html') # # index.html aaƤaa # # tests.py from django.test import TestCase class TestViews(TestCase): def test_index(self): response = self.client.get('/') self.assertContains(response, u'aa') # # results in: ====================================================================== ERROR: test_index (stuff.tests.TestViews) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/johan/devel/tester/stuff/tests.py", line 6, in test_index self.assertContains(response, u'aa') File "/usr/lib/python2.5/site-packages/django/test/testcases.py", line 267, in assertContains real_count = response.content.count(text) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 2: ordinal not in range(128) ---------------------------------------------------------------------- }}} -- Ticket URL: <http://code.djangoproject.com/ticket/10183> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---