Skip to content

Commit bca573b

Browse files
committed
Move generator expression tests into one file.
1 parent 266553d commit bca573b

File tree

4 files changed

+34
-74
lines changed

4 files changed

+34
-74
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_generator-expression-next.py

Lines changed: 0 additions & 33 deletions
This file was deleted.

graalpython/com.oracle.graal.python.test/src/tests/test_generator-expression-sum-2.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

graalpython/com.oracle.graal.python.test/src/tests/test_generator-expression-sum.py renamed to graalpython/com.oracle.graal.python.test/src/tests/test_generator-expressions.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2018, Oracle and/or its affiliates.
1+
# Copyright (c) 2018, 2019, Oracle and/or its affiliates.
22
# Copyright (c) 2013, Regents of the University of California
33
#
44
# All rights reserved.
@@ -34,3 +34,35 @@ def _sum(iterable):
3434

3535
assert _sum(genexp) == 20
3636
assert _sum(genexp) == 0
37+
38+
39+
def test_sum2():
40+
genexp = (x*2 for x in range(5))
41+
42+
sum = 0
43+
for i in genexp:
44+
sum += i
45+
assert sum == 20
46+
47+
sum = 0
48+
for i in genexp:
49+
sum += i
50+
assert sum == 0
51+
52+
53+
def test_genexp():
54+
genexp = (x*2 for x in range(5))
55+
56+
genexp.__next__()
57+
genexp.__next__()
58+
genexp.__next__()
59+
genexp.__next__()
60+
assert genexp.__next__() == 8
61+
62+
63+
def test_list_comprehension():
64+
def make_list(size):
65+
return [i for i in range(size)]
66+
67+
ll = make_list(100000)
68+
assert ll[-1] == 99999

mx.graalpython/copyrights/overrides

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,7 @@ graalpython/com.oracle.graal.python.test/src/tests/test_euler31.py,benchmarks.co
218218
graalpython/com.oracle.graal.python.test/src/tests/test_exception.py,python.copyright
219219
graalpython/com.oracle.graal.python.test/src/tests/test_generator-accumulator.py,zippy.copyright
220220
graalpython/com.oracle.graal.python.test/src/tests/test_generator-continue.py,zippy.copyright
221-
graalpython/com.oracle.graal.python.test/src/tests/test_generator-expression-next.py,zippy.copyright
222-
graalpython/com.oracle.graal.python.test/src/tests/test_generator-expression-sum-2.py,zippy.copyright
223-
graalpython/com.oracle.graal.python.test/src/tests/test_generator-expression-sum.py,zippy.copyright
221+
graalpython/com.oracle.graal.python.test/src/tests/test_generator-expressions.py,zippy.copyright
224222
graalpython/com.oracle.graal.python.test/src/tests/test_generator-if-and-loop.py,zippy.copyright
225223
graalpython/com.oracle.graal.python.test/src/tests/test_generator-inline-genexp-builtin.py,zippy.copyright
226224
graalpython/com.oracle.graal.python.test/src/tests/test_generator-inline-genexp-localvar.py,zippy.copyright

0 commit comments

Comments
 (0)