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

hpk at codespeak.net hpk at codespeak.net
Mon Nov 22 11:45:48 CET 2004


Author: hpk
Date: Mon Nov 22 11:45:48 2004
New Revision: 7549

Modified:
   pypy/trunk/src/pypy/translator/test/snippet.py
   pypy/trunk/src/pypy/translator/test/test_annrpython.py
Log:
added a (still disabled) test that checks
for an upcoming feature (idea): if a SomeInstance 
is unified with a SomePBC then the SomeInstance
should be retained and should put information about
the SomePBC in the SomeInstance's classdef.  



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	Mon Nov 22 11:45:48 2004
@@ -600,3 +600,17 @@
 def func_arg_unpack():
     a,b = 3, "hello"
     return a
+
+class APBC: 
+    def f(self): 
+        pass
+    code = f.func_code 
+
+apbc = APBC()
+
+def preserve_pbc_attr_on_instance(cond):
+    if cond: 
+        x = APBC()
+    else: 
+        x = apbc 
+    return x.code 

Modified: pypy/trunk/src/pypy/translator/test/test_annrpython.py
==============================================================================
--- pypy/trunk/src/pypy/translator/test/test_annrpython.py	(original)
+++ pypy/trunk/src/pypy/translator/test/test_annrpython.py	Mon Nov 22 11:45:48 2004
@@ -331,6 +331,15 @@
         self.assert_(isinstance(s, annmodel.SomeInteger)) 
         self.assertEquals(s.const, 3) 
 
+    def test_pbc_attr_preserved_on_instance(self):
+        a = RPythonAnnotator()
+        s = a.build_types(snippet.preserve_pbc_attr_on_instance, [bool])
+        #a.simplify()
+        #a.translator.view()
+        #self.assert_(isinstance(s, annmodel.SomeInstance)) 
+        #self.assertEquals(s.const, 3) 
+        
+
 def g(n):
     return [0,1,2,n]
 



More information about the Pypy-commit mailing list