[pypy-svn] rev 691 - pypy/trunk/src/pypy/objspace/std/test
tomek at codespeak.net
tomek at codespeak.net
Thu May 29 17:03:01 CEST 2003
Author: tomek
Date: Thu May 29 17:03:01 2003
New Revision: 691
Modified:
pypy/trunk/src/pypy/objspace/std/test/test_stringobject.py
Log:
generic tests for rich comparission
Modified: pypy/trunk/src/pypy/objspace/std/test/test_stringobject.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/test/test_stringobject.py (original)
+++ pypy/trunk/src/pypy/objspace/std/test/test_stringobject.py Thu May 29 17:03:01 2003
@@ -17,17 +17,20 @@
space = self.space
def w(txt):
return W_StringObject(space, txt)
- strs = ['ala', 'bla', 'ala', 'alaaa', 'blaa', 'g']
+ strs = ['ala', 'bla', 'ala', 'alaaa', '', 'b']
ops = [ 'EQ', 'LT', 'GT', 'NE', 'LE', 'GE' ]
- for op in ops:
- pass
- #print getattr('a', '__%s__' % op.lower())
- #while strs[1:]:
-
-
-
- self.failUnless_w(string_richcompare(space, w('abc'), w('abc'), EQ))
+ while strs[1:]:
+ str1 = strs.pop()
+ for op in ops:
+ orf = getattr(str1, '__%s__' % op.lower()) #original python function
+ pypyconst = getattr(so, op)
+ for str2 in strs:
+ if orf(str2):
+ self.failUnless_w(string_richcompare(space, w(str1), w(str2), pypyconst))
+ else:
+ self.failIf_w(string_richcompare(space, w(str1), w(str2), pypyconst))
+
def test_equality(self):
More information about the Pypy-commit
mailing list