[Zope3-dev] Re: str to unicode promotion test failures (with patch)
Tres Seaver
tseaver at zope.com
Wed Oct 13 00:27:23 EDT 2004
Osvaldo Santana wrote:
> Hi,
>
> I'm attaching a little patch to fix failures in zope.app.container tests.
>
> I don't know if this is the correct solution for this problem but in
> my Python is possible to promote a string with hi-bit-set characters
> to unicode (charset Latin1/ISO8859-1):
>
> ---
> Python 2.3.4 (#1, Aug 15 2004, 14:14:00)
> [GCC 3.3.3 (release)] on linux-i386
>
>>>>s = "A string with hi-bit-set characters: \700\701"
>>>>unicode(s)
>
> u'A string with hi-bit-set characters: \xc0\xc1'
> ---
>
> This situation causes failures in BTrees tests too:
>
> Error in test testBucketGet (BTrees.tests.test_compare.CompareTest)
> Traceback (most recent call last):
> File "/home/osvaldo/Zope3/src/BTrees/tests/test_compare.py", line 32, in setUp
> self.assertRaises(UnicodeError, unicode, self.s)
> File "/usr/lib/python2.3/unittest.py", line 295, in failUnlessRaises
> raise self.failureException, excName
> AssertionError: UnicodeError
I'll bet you have a 'sys.setdefaultencoding' in your Python's site.py;
try rerunning the test without it, and see if it fails.
Tres.
--
===============================================================
Tres Seaver tseaver at zope.com
Zope Corporation "Zope Dealers" http://www.zope.com
More information about the Zope3-dev
mailing list