[pypy-svn] r4974 - pypy/trunk/src/pypy/translator/test
hpk at codespeak.net
hpk at codespeak.net
Sat Jun 5 16:08:33 CEST 2004
Author: hpk
Date: Sat Jun 5 16:08:33 2004
New Revision: 4974
Modified:
pypy/trunk/src/pypy/translator/test/run_snippet.py
pypy/trunk/src/pypy/translator/test/snippet.py
Log:
- run all combinations of argument types
- small fixes
Modified: pypy/trunk/src/pypy/translator/test/run_snippet.py
==============================================================================
--- pypy/trunk/src/pypy/translator/test/run_snippet.py (original)
+++ pypy/trunk/src/pypy/translator/test/run_snippet.py Sat Jun 5 16:08:33 2004
@@ -52,16 +52,25 @@
if not specnamelist:
l.append(value)
return l
-
+
+
+def combine(lists):
+ if not lists:
+ yield []
+ else:
+ head = lists[0]
+ if not isinstance(head, tuple):
+ head = (head,)
+ tail = lists[1:]
+ for item in head:
+ for com in combine(tail):
+ yield [item] + com
+
def get_arg_types(func):
# func_defaults e.g.: ([int, float], [str, int], int)
if func.func_defaults:
- argstypelist = []
- for spec in func.func_defaults:
- if isinstance(spec, tuple):
- spec = spec[0] # use the first type only for the tests
- argstypelist.append(spec)
- yield argstypelist
+ for argtypeslist in combine(func.func_defaults):
+ yield argtypeslist
else:
yield []
@@ -84,6 +93,7 @@
print format_str %("functioncall", "flowed", "annotated", "compiled")
for func in funcs:
for argtypeslist in get_arg_types(func):
+ #print "trying %s %s" %(func, argtypeslist)
result = Result(func, argtypeslist)
results.append(result)
print repr_result(result)
@@ -91,7 +101,7 @@
traceback.print_exception(*result.excinfo)
raise SystemExit, 1
- for res in results:
- print repr_result(res)
+ #for res in results:
+ # print repr_result(res)
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 Sat Jun 5 16:08:33 2004
@@ -26,7 +26,7 @@
# the possible types that can be passed to
# the specific snippet.
numtype = (int, float, )
-anytype = (int, float, str, )
+anytype = (int, float, str)
seqtype = (list, tuple)
def if_then_else(cond=anytype, x=anytype, y=anytype):
More information about the Pypy-commit
mailing list