From 5314219f182e8a303e3fa68e2bacca978cb08002 Mon Sep 17 00:00:00 2001 From: Rami Ali Date: Tue, 17 Jan 2017 16:03:30 +1100 Subject: [PATCH] tests/basics: Improve runtime.c test coverage. --- tests/basics/fun_calldblstar3.py | 3 ++- tests/basics/fun_callstar.py | 5 +++++ tests/basics/iter0.py | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/basics/fun_calldblstar3.py b/tests/basics/fun_calldblstar3.py index 4367e68df7..b796d52c7e 100644 --- a/tests/basics/fun_calldblstar3.py +++ b/tests/basics/fun_calldblstar3.py @@ -5,7 +5,8 @@ def foo(**kw): class Mapping: def keys(self): - return ['a', 'b', 'c'] + # the long string checks the case of string interning + return ['a', 'b', 'c', 'abcdefghijklmnopqrst'] def __getitem__(self, key): if key == 'a': diff --git a/tests/basics/fun_callstar.py b/tests/basics/fun_callstar.py index 2275d3d4fc..a27a288a3c 100644 --- a/tests/basics/fun_callstar.py +++ b/tests/basics/fun_callstar.py @@ -17,6 +17,11 @@ foo(*range(3)) # pos then iterator foo(1, *range(2, 4)) +# an iterator with many elements +def foo(*rest): + print(rest) +foo(*range(10)) + # method calls with *pos class A: diff --git a/tests/basics/iter0.py b/tests/basics/iter0.py index 6110e8fa58..d20ade7fee 100644 --- a/tests/basics/iter0.py +++ b/tests/basics/iter0.py @@ -4,3 +4,6 @@ try: pass except TypeError: print('TypeError') + +# builtin type that is iterable, calling __next__ explicitly +print(iter(range(4)).__next__())