[pypy-svn] r43297 - in pypy/branch/pypy-string-formatting/rpython: . test
arigo at codespeak.net
arigo at codespeak.net
Sat May 12 15:38:09 CEST 2007
Author: arigo
Date: Sat May 12 15:38:09 2007
New Revision: 43297
Modified:
pypy/branch/pypy-string-formatting/rpython/rstr.py
pypy/branch/pypy-string-formatting/rpython/test/test_rstr.py
Log:
Bug, test, fix.
Modified: pypy/branch/pypy-string-formatting/rpython/rstr.py
==============================================================================
--- pypy/branch/pypy-string-formatting/rpython/rstr.py (original)
+++ pypy/branch/pypy-string-formatting/rpython/rstr.py Sat May 12 15:38:09 2007
@@ -437,6 +437,8 @@
class __extend__(AbstractUniCharRepr):
def convert_const(self, value):
+ if isinstance(value, str):
+ value = unicode(value)
if not isinstance(value, unicode) or len(value) != 1:
raise TyperError("not a unicode character: %r" % (value,))
return value
Modified: pypy/branch/pypy-string-formatting/rpython/test/test_rstr.py
==============================================================================
--- pypy/branch/pypy-string-formatting/rpython/test/test_rstr.py (original)
+++ pypy/branch/pypy-string-formatting/rpython/test/test_rstr.py Sat May 12 15:38:09 2007
@@ -168,6 +168,13 @@
assert self.interpret(fn, ['(', u'(']) == True
assert self.interpret(fn, ['(', u'\u1028']) == False
+ def test_char_unichar_eq_2(self):
+ def fn(c1):
+ return c1 == 'X'
+ assert self.interpret(fn, [u'(']) == False
+ assert self.interpret(fn, [u'\u1058']) == False
+ assert self.interpret(fn, [u'X']) == True
+
def test_is_none(self):
def fn(i):
s1 = ['foo', None][i]
More information about the pypy-svn
mailing list