[pypy-svn] r8559 - in pypy/dist/pypy: annotation translator/test

adim at codespeak.net adim at codespeak.net
Tue Jan 25 14:48:05 CET 2005


Author: adim
Date: Tue Jan 25 14:48:05 2005
New Revision: 8559

Modified:
   pypy/dist/pypy/annotation/unaryop.py
   pypy/dist/pypy/translator/test/snippet.py
   pypy/dist/pypy/translator/test/test_annrpython.py
Log:
SomeDict.copy() + test


Modified: pypy/dist/pypy/annotation/unaryop.py
==============================================================================
--- pypy/dist/pypy/annotation/unaryop.py	(original)
+++ pypy/dist/pypy/annotation/unaryop.py	Tue Jan 25 14:48:05 2005
@@ -112,7 +112,9 @@
     def iter(dct):
 	return SomeIterator(dct.s_key)
 
-
+    def method_copy(dct):
+	return SomeDict(dct.factories, dct.s_key, dct.s_value)
+    
 class __extend__(SomeString):
 
     def method_join(str, s_list):

Modified: pypy/dist/pypy/translator/test/snippet.py
==============================================================================
--- pypy/dist/pypy/translator/test/snippet.py	(original)
+++ pypy/dist/pypy/translator/test/snippet.py	Tue Jan 25 14:48:05 2005
@@ -661,3 +661,6 @@
 
 def simple_iter(x):
     return iter(x)
+
+def dict_copy(d):
+    return d.copy()

Modified: pypy/dist/pypy/translator/test/test_annrpython.py
==============================================================================
--- pypy/dist/pypy/translator/test/test_annrpython.py	(original)
+++ pypy/dist/pypy/translator/test/test_annrpython.py	Tue Jan 25 14:48:05 2005
@@ -409,6 +409,14 @@
         s = a.build_types(snippet.simple_iter, [t])
         assert isinstance(s, annmodel.SomeIterator)
 	
+    def test_dict_copy(self):
+        a = RPythonAnnotator()
+	t = annmodel.SomeDict({}, annmodel.SomeInteger(), annmodel.SomeInteger())
+        s = a.build_types(snippet.dict_copy, [t])
+	assert isinstance(s, annmodel.SomeDict)
+	assert isinstance(s.s_key, annmodel.SomeInteger)
+	assert isinstance(s.s_value, annmodel.SomeInteger)
+
 
 def g(n):
     return [0,1,2,n]



More information about the Pypy-commit mailing list