[pypy-svn] r26747 - in pypy/dist/pypy/translator/cl: . test
sanxiyn at codespeak.net
sanxiyn at codespeak.net
Thu May 4 07:17:37 CEST 2006
Author: sanxiyn
Date: Thu May 4 07:17:32 2006
New Revision: 26747
Modified:
pypy/dist/pypy/translator/cl/opformatter.py
pypy/dist/pypy/translator/cl/test/test_dict.py
Log:
Pass dict_iter test, in a wrong way
Modified: pypy/dist/pypy/translator/cl/opformatter.py
==============================================================================
--- pypy/dist/pypy/translator/cl/opformatter.py (original)
+++ pypy/dist/pypy/translator/cl/opformatter.py Thu May 4 07:17:32 2006
@@ -200,7 +200,13 @@
return "(setf (gethash %s %s) %s)" % (key, self.obj, value)
def ll_get_items_iterator(self):
- raise NotImplementedError()
+ # This is explicitly unspecified by the specification.
+ # Should think of a better way to do this.
+ return """\
+(let ((temp (gensym)))
+ (setf (symbol-value temp)
+ (with-hash-table-iterator (iter %s)
+ (lambda () (iter)))) temp)""" % (self.obj,)
class DictItemsIteratorImpl:
@@ -208,8 +214,12 @@
self.obj = obj
def ll_go_next(self):
- raise NotImplementedError()
+ return """\
+(multiple-value-bind (more key value)
+ (funcall (symbol-value %s))
+ (setf (get %s 'key) key)
+ (setf (get %s 'value) value)
+ more)""" % (self.obj, self.obj, self.obj)
def ll_current_key(self):
- raise NotImplementedError()
-
+ return "(get %s 'key)" % (self.obj,)
Modified: pypy/dist/pypy/translator/cl/test/test_dict.py
==============================================================================
--- pypy/dist/pypy/translator/cl/test/test_dict.py (original)
+++ pypy/dist/pypy/translator/cl/test/test_dict.py Thu May 4 07:17:32 2006
@@ -16,7 +16,6 @@
assert cl_dict_get(42) == 43
def test_dict_iter():
- py.test.skip("not supported yet")
def dict_iter():
dic = {1:2, 3:4, 5:6}
i = 0
More information about the Pypy-commit
mailing list