summaryrefslogtreecommitdiff
path: root/tests/test_response.py
diff options
context:
space:
mode:
authorSergey Schetinin <sergey@maluke.com>2011-08-09 17:58:40 +0300
committerSergey Schetinin <sergey@maluke.com>2011-08-09 17:58:40 +0300
commit24ce33787d56018f904531e57499ab18a40e8c5f (patch)
treea5c72947bae5ff1e556742424e9cb76914723187 /tests/test_response.py
parent9aef90027e4f307d246e9a9ff44835b7dcb065ed (diff)
downloadwebob-24ce33787d56018f904531e57499ab18a40e8c5f.tar.gz
fix test on Jython (did you know that 'abc'.encode('utf-16') produces different
strings on Jython and CPython?)
Diffstat (limited to 'tests/test_response.py')
-rw-r--r--tests/test_response.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/test_response.py b/tests/test_response.py
index 803942d..2dd4e17 100644
--- a/tests/test_response.py
+++ b/tests/test_response.py
@@ -554,11 +554,12 @@ def test_text_get_no_charset():
def test_unicode_body():
res = Response()
res.charset = 'utf-8'
- res.body = 'La Pe\xc3\xb1a'
- eq_(res.unicode_body, unicode('La Pe\xc3\xb1a', 'utf-8'))
- res.charset = 'UTF-16'
- res.ubody = u'abc'
- eq_(res.body, '\xff\xfea\x00b\x00c\x00')
+ bbody = 'La Pe\xc3\xb1a' # binary string
+ ubody = unicode(bbody, 'utf-8') # unicode string
+ res.body = bbody
+ eq_(res.unicode_body, ubody)
+ res.ubody = ubody
+ eq_(res.body, bbody)
del res.ubody
eq_(res.body, '')