[pypy-svn] r13572 - pypy/dist/pypy/translator/test
arigo at codespeak.net
arigo at codespeak.net
Sat Jun 18 01:21:43 CEST 2005
Author: arigo
Date: Sat Jun 18 01:21:42 2005
New Revision: 13572
Modified:
pypy/dist/pypy/translator/test/test_annrpython.py
Log:
Test for last fix by Samuele.
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 Sat Jun 18 01:21:42 2005
@@ -1342,6 +1342,25 @@
assert isinstance(s_item, annmodel.SomeList)
assert s_item.listdef.same_as(s.listdef)
+ def test_defaults_with_list_or_dict(self):
+ def fn1(a=[]):
+ return a
+ def fn2(a={}):
+ return a
+ def f():
+ fn1()
+ fn2()
+ return fn1([6, 7]), fn2({2: 3, 4: 5})
+ a = self.RPythonAnnotator()
+ s = a.build_types(f, [])
+ assert isinstance(s, annmodel.SomeTuple)
+ s1, s2 = s.items
+ assert not s1.is_constant()
+ assert not s2.is_constant()
+ assert isinstance(s1.listdef.listitem. s_value, annmodel.SomeInteger)
+ assert isinstance(s2.dictdef.dictkey. s_value, annmodel.SomeInteger)
+ assert isinstance(s2.dictdef.dictvalue.s_value, annmodel.SomeInteger)
+
def g(n):
return [0,1,2,n]
More information about the Pypy-commit
mailing list