[pypy-svn] pypy default: For no reason, unicodedata.mirrored() returns an int, not a bool.
amauryfa
commits-noreply at bitbucket.org
Mon Jan 24 18:35:25 CET 2011
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch:
Changeset: r41265:1b88f6a308b1
Date: 2011-01-24 18:09 +0100
http://bitbucket.org/pypy/pypy/changeset/1b88f6a308b1/
Log: For no reason, unicodedata.mirrored() returns an int, not a bool.
Yes, some test relies on this.
diff --git a/pypy/module/unicodedata/test/test_unicodedata.py b/pypy/module/unicodedata/test/test_unicodedata.py
--- a/pypy/module/unicodedata/test/test_unicodedata.py
+++ b/pypy/module/unicodedata/test/test_unicodedata.py
@@ -99,6 +99,11 @@
else:
assert len(lines) == 1
+ def test_mirrored(self):
+ import unicodedata
+ # For no reason, unicodedata.mirrored() returns an int, not a bool
+ assert repr(unicodedata.mirrored(u' ')) == '0'
+
class TestUnicodeData(object):
def setup_class(cls):
import random, unicodedata
diff --git a/pypy/module/unicodedata/interp_ucd.py b/pypy/module/unicodedata/interp_ucd.py
--- a/pypy/module/unicodedata/interp_ucd.py
+++ b/pypy/module/unicodedata/interp_ucd.py
@@ -208,7 +208,8 @@
def mirrored(self, space, w_unichr):
code = unichr_to_code_w(space, w_unichr)
- return space.wrap(self._mirrored(code))
+ # For no reason, unicodedata.mirrored() returns an int, not a bool
+ return space.wrap(int(self._mirrored(code)))
mirrored.unwrap_spec = ['self', ObjSpace, W_Root]
def decomposition(self, space, w_unichr):
More information about the Pypy-commit
mailing list