[pypy-svn] r27232 - in pypy/dist/pypy/rpython/ootypesystem: . test
antocuni at codespeak.net
antocuni at codespeak.net
Mon May 15 13:57:29 CEST 2006
Author: antocuni
Date: Mon May 15 13:57:24 2006
New Revision: 27232
Modified:
pypy/dist/pypy/rpython/ootypesystem/ootype.py
pypy/dist/pypy/rpython/ootypesystem/test/test_oostring.py
Log:
Removed the __getattr__ trick from ootype._string because it didn't
work with the annotator.
Modified: pypy/dist/pypy/rpython/ootypesystem/ootype.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/ootype.py (original)
+++ pypy/dist/pypy/rpython/ootypesystem/ootype.py Mon May 15 13:57:24 2006
@@ -827,30 +827,6 @@
# NOT_RPYTHON
return self._str.endswith(s._str)
- # delegate missing ll_* methods to self._str
- def __getattr__(self, attr):
- if attr.startswith('ll_'):
- return self.wrapper(getattr(self._str, attr[3:]))
- else:
- raise AttributeError, attr
-
- def wrapper(fn):
- def f(*args):
- res = fn(*args)
- if isinstance(res, str):
- return make_string(res)
- elif isinstance(res, list):
- # it must be a list of strings
- for i, item in enumerate(res):
- res[i] = make_string(item)
- lst = _list(List(String))
- lst._list = res
- return lst
- else:
- return res
- return f
- wrapper = staticmethod(wrapper)
-
class _null_string(_null_mixin(_string), _string):
def __init__(self, STRING):
self.__dict__["_TYPE"] = STRING
Modified: pypy/dist/pypy/rpython/ootypesystem/test/test_oostring.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/test/test_oostring.py (original)
+++ pypy/dist/pypy/rpython/ootypesystem/test/test_oostring.py Mon May 15 13:57:24 2006
@@ -7,18 +7,6 @@
res = interpret(f, [], type_system="ootype")
assert res._str == "foo"
-def test_builtin_method():
- s = ootype.make_string('foo bar')
- assert s.ll_startswith('foo') == True
- assert s.ll_upper()._str == 'FOO BAR'
-
-def test_split():
- s = ootype.make_string('foo bar')
- res = s.ll_split()
- assert isinstance(res, ootype._list)
- assert res.ll_getitem_fast(0)._str == 'foo'
- assert res.ll_getitem_fast(1)._str == 'bar'
-
def test_string_builder():
b = ootype.new(ootype.StringBuilder)
b.ll_append_char('a')
More information about the Pypy-commit
mailing list