[pypy-svn] r6728 - pypy/trunk/src/pypy/translator/test
arigo at codespeak.net
arigo at codespeak.net
Fri Sep 24 20:10:33 CEST 2004
Author: arigo
Date: Fri Sep 24 20:10:32 2004
New Revision: 6728
Modified:
pypy/trunk/src/pypy/translator/test/snippet.py
pypy/trunk/src/pypy/translator/test/test_annrpython.py
pypy/trunk/src/pypy/translator/test/test_ctrans.py
Log:
A new failing test that shows a limitation of genc.py with list concatenation.
This check-in also adds the new test to test_annrpython to ensure that it is
correctly annotated (this succeeds).
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 Fri Sep 24 20:10:32 2004
@@ -254,6 +254,15 @@
_append_five(a)
return a
+def _append_six(lst):
+ lst += [6]
+
+def call_five_six():
+ a = []
+ _append_five(a)
+ _append_six(a)
+ return a
+
# INHERITANCE / CLASS TESTS
class C(object): pass
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 Fri Sep 24 20:10:32 2004
@@ -237,6 +237,20 @@
# XXX not sure this is the best behavior...
self.assertEquals(s, annmodel.immutablevalue(42))
+ def test_call_five(self):
+ a = RPythonAnnotator()
+ s = a.build_types(snippet.call_five, [])
+ # returns should be a list of constants (= 5)
+ self.assert_(isinstance(s, annmodel.SomeList))
+ self.assertEquals(s.s_item, annmodel.immutablevalue(5))
+
+ def test_call_five_six(self):
+ a = RPythonAnnotator()
+ s = a.build_types(snippet.call_five_six, [])
+ # returns should be a list of positive integers
+ self.assert_(isinstance(s, annmodel.SomeList))
+ self.assertEquals(s.s_item, annmodel.SomeInteger(nonneg=True))
+
def g(n):
return [0,1,2,n]
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 Fri Sep 24 20:10:32 2004
@@ -136,6 +136,14 @@
# that can't be inspected from Python.
self.assertEquals(result.__class__.__name__[:8], "list of ")
+ def test_call_five_six(self):
+ call_five_six = self.getcompiled(snippet.call_five_six)
+ result = call_five_six()
+ #self.assertEquals(result, [5, 6])
+ # -- currently result isn't a real list, but a pseudo-array
+ # that can't be inspected from Python.
+ self.assertEquals(result.__class__.__name__[:8], "list of ")
+
def test_class_defaultattr(self):
class K:
n = "hello"
More information about the Pypy-commit
mailing list