[Zope-Coders] Re: BTrees, Unicode, and Python 2.2
Guido van Rossum
guido@python.org
Thu, 18 Oct 2001 11:12:28 -0400
> The unittest fails with the following setUp() function:
>
> def setUp(self):
> """ setup an OOBTree with some unicode strings """
>
> self.s = unicode('dreit\xe4gigen','latin1')
>
> self.data = [('alien', 284708388),
> ('fox', 284708387),
> ('future', 284708388),
> ('k\xf6nnten', 284708389),
> ('quick', 284708387),
> ('zerst\xf6rt', 284708389),
> (unicode('dreit\xe4gigen','latin1'), 284708391)]
>
> self.tree = OOBTree()
> for k,v in self.data: self.tree[k]=v
>
> But it works with the following (last line of self.data changed):
>
> def setUp(self):
> """ setup an OOBTree with some unicode strings """
>
> self.s = unicode('dreit\xe4gigen','latin1')
>
> self.data = [('alien', 284708388),
> ('fox', 284708387),
> ('future', 284708388),
> ('k\xf6nnten', 284708389),
> ('quick', 284708387),
> ('zerst\xf6rt', 284708389),
> (self.s, 284708391)]
>
> self.tree = OOBTree()
> for k,v in self.data: self.tree[k]=v
>
> Any explanations for this behaviour ?
Bizarre. The value of self.data is the same in both cases. Please
show the rest of the code that fails. What kind of error do you get?
--Guido van Rossum (home page: http://www.python.org/~guido/)