[pypy-svn] r7294 - pypy/trunk/src/pypy/translator/test

mwh at codespeak.net mwh at codespeak.net
Tue Nov 16 17:32:50 CET 2004


Author: mwh
Date: Tue Nov 16 17:32:50 2004
New Revision: 7294

Modified:
   pypy/trunk/src/pypy/translator/test/snippet.py
   pypy/trunk/src/pypy/translator/test/test_ctrans.py
Log:
add a test that unreferenced __init__ methods are not translated.
commented out, because it doesn't work.
current thinking is that this sort of thing will only work in
conjunction with annotation.


Modified: pypy/trunk/src/pypy/translator/test/snippet.py
==============================================================================
--- pypy/trunk/src/pypy/translator/test/snippet.py	(original)
+++ pypy/trunk/src/pypy/translator/test/snippet.py	Tue Nov 16 17:32:50 2004
@@ -419,6 +419,20 @@
 def global_recursive_list():
     return global_rl
 
+class BadInit(object):
+    def update(self, k):
+        self.k = 1
+    def __init__(self, v):
+        self.update(**{'k':v})
+    def read(self):
+        return self.k
+
+global_bi = BadInit(1)
+
+def global_badinit():
+    return global_bi.read()
+    
+
 def powerset(setsize=int):
     """Powerset
 

Modified: pypy/trunk/src/pypy/translator/test/test_ctrans.py
==============================================================================
--- pypy/trunk/src/pypy/translator/test/test_ctrans.py	(original)
+++ pypy/trunk/src/pypy/translator/test/test_ctrans.py	Tue Nov 16 17:32:50 2004
@@ -113,6 +113,10 @@
         self.assertEquals(len(lst), 1)
         self.assert_(lst[0] is lst)
 
+##     def test_global_badinit(self):
+##         global_badinit = self.build_cfunc(snippet.global_badinit)
+##         self.assertEquals(global_badinit(), 1)
+
 class TypedTestCase(testit.IntTestCase):
 
     def getcompiled(self, func):



More information about the Pypy-commit mailing list