tests/basics: Improve runtime.c test coverage.

This commit is contained in:
Rami Ali 2017-01-17 16:03:30 +11:00 committed by Damien George
parent cba723fc8c
commit 5314219f18
3 changed files with 10 additions and 1 deletions

View File

@ -5,7 +5,8 @@ def foo(**kw):
class Mapping: class Mapping:
def keys(self): 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): def __getitem__(self, key):
if key == 'a': if key == 'a':

View File

@ -17,6 +17,11 @@ foo(*range(3))
# pos then iterator # pos then iterator
foo(1, *range(2, 4)) foo(1, *range(2, 4))
# an iterator with many elements
def foo(*rest):
print(rest)
foo(*range(10))
# method calls with *pos # method calls with *pos
class A: class A:

View File

@ -4,3 +4,6 @@ try:
pass pass
except TypeError: except TypeError:
print('TypeError') print('TypeError')
# builtin type that is iterable, calling __next__ explicitly
print(iter(range(4)).__next__())