[pypy-svn] r48411 - pypy/branch/pypy-rpython-unicode/rpython/test
fijal at codespeak.net
fijal at codespeak.net
Thu Nov 8 14:20:33 CET 2007
Author: fijal
Date: Thu Nov 8 14:20:32 2007
New Revision: 48411
Modified:
pypy/branch/pypy-rpython-unicode/rpython/test/test_rstr.py
pypy/branch/pypy-rpython-unicode/rpython/test/test_runicode.py
Log:
Shuffle tests around, so unichar tests are in test_runicode now, not in
test_rstr.
Modified: pypy/branch/pypy-rpython-unicode/rpython/test/test_rstr.py
==============================================================================
--- pypy/branch/pypy-rpython-unicode/rpython/test/test_rstr.py (original)
+++ pypy/branch/pypy-rpython-unicode/rpython/test/test_rstr.py Thu Nov 8 14:20:32 2007
@@ -141,55 +141,6 @@
res = self.interpret(fn, [const('5'), 3])
assert res == 5551
- def test_unichar_const(self):
- def fn(c):
- return c
- assert self.interpret(fn, [u'\u03b1']) == u'\u03b1'
-
- def test_unichar_eq(self):
- def fn(c1, c2):
- return c1 == c2
- assert self.interpret(fn, [u'\u03b1', u'\u03b1']) == True
- assert self.interpret(fn, [u'\u03b1', u'\u03b2']) == False
-
- def test_unichar_ord(self):
- def fn(c):
- return ord(c)
- assert self.interpret(fn, [u'\u03b1']) == ord(u'\u03b1')
-
- def test_unichar_hash(self):
- def fn(c):
- d = {c: 42}
- return d[c]
- assert self.interpret(fn, [u'\u03b1']) == 42
-
- def test_convert_char_to_unichar(self):
- def g(c):
- return ord(c)
- def fn(n):
- if n < 0:
- c = unichr(-n)
- else:
- c = chr(n)
- return g(c)
- assert self.interpret(fn, [65]) == 65
- assert self.interpret(fn, [-5555]) == 5555
-
- def test_char_unichar_eq(self):
- def fn(c1, c2):
- return c1 == c2
- assert self.interpret(fn, [u'(', '(']) == True
- assert self.interpret(fn, [u'\u1028', '(']) == False
- 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):
const = self.const
def fn(i):
Modified: pypy/branch/pypy-rpython-unicode/rpython/test/test_runicode.py
==============================================================================
--- pypy/branch/pypy-rpython-unicode/rpython/test/test_runicode.py (original)
+++ pypy/branch/pypy-rpython-unicode/rpython/test/test_runicode.py Thu Nov 8 14:20:32 2007
@@ -1,6 +1,6 @@
-from pypy.rpython.test.tool import LLRtypeMixin
+from pypy.rpython.test.tool import LLRtypeMixin, OORtypeMixin
from pypy.rpython.test.test_rstr import AbstractTestRstr
import py
@@ -40,6 +40,56 @@
const = unicode
assert self.ll_to_unicode(self.interpret(f, [1])) == f(1)
+
+ def test_unichar_const(self):
+ def fn(c):
+ return c
+ assert self.interpret(fn, [u'\u03b1']) == u'\u03b1'
+
+ def test_unichar_eq(self):
+ def fn(c1, c2):
+ return c1 == c2
+ assert self.interpret(fn, [u'\u03b1', u'\u03b1']) == True
+ assert self.interpret(fn, [u'\u03b1', u'\u03b2']) == False
+
+ def test_unichar_ord(self):
+ def fn(c):
+ return ord(c)
+ assert self.interpret(fn, [u'\u03b1']) == ord(u'\u03b1')
+
+ def test_unichar_hash(self):
+ def fn(c):
+ d = {c: 42}
+ return d[c]
+ assert self.interpret(fn, [u'\u03b1']) == 42
+
+ def test_convert_char_to_unichar(self):
+ def g(c):
+ return ord(c)
+ def fn(n):
+ if n < 0:
+ c = unichr(-n)
+ else:
+ c = chr(n)
+ return g(c)
+ assert self.interpret(fn, [65]) == 65
+ assert self.interpret(fn, [-5555]) == 5555
+
+ def test_char_unichar_eq(self):
+ def fn(c1, c2):
+ return c1 == c2
+ assert self.interpret(fn, [u'(', '(']) == True
+ assert self.interpret(fn, [u'\u1028', '(']) == False
+ 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 unsupported(self):
py.test.skip("not supported")
@@ -61,3 +111,5 @@
EMPTY_STRING_HASH = -1
ll_to_string = LLRtypeMixin.ll_to_unicode
+#class TestOOtype(BaseTestRUnicode, OORtypeMixin):
+# pass
More information about the Pypy-commit
mailing list