﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
10183	assertContains fails when there is unicode in the response content	drakonen	nobody	"{{{
# 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)

----------------------------------------------------------------------
}}}
"		closed	Testing framework	1.0		fixed	testcases, assertContains, assertNotContains		Accepted	1	0	0	0	0	0
