Skip to content

Commit 9a00643

Browse files
committed
[GR-14075] In virtual env the parameters are not given to graalpython correctly
PullRequest: graalpython/416
2 parents 9b92006 + 174ad7d commit 9a00643

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright (c) 2019, Oracle and/or its affiliates.
2+
# Copyright (C) 1996-2017 Python Software Foundation
3+
#
4+
# Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
5+
6+
import unittest
7+
from itertools import *
8+
9+
class CombinationsTests(unittest.TestCase):
10+
11+
def test_combinations_with_replacement(self):
12+
cwr = combinations_with_replacement
13+
self.assertRaises(TypeError, cwr, 'abc') # missing r argument
14+
self.assertRaises(TypeError, cwr, 'abc', 2, 1) # too many arguments
15+
self.assertRaises(TypeError, cwr, None) # pool is not iterable
16+
self.assertRaises(ValueError, cwr, 'abc', -2) # r is negative
17+
18+
result = list()
19+
for a in cwr('ABC', 2):
20+
result += a
21+
correct = [('A','A'), ('A','B'), ('A','C'), ('B','B'), ('B','C'), ('C','C')]
22+
compare = list();
23+
for a in correct:
24+
compare += a;
25+
self.assertEqual(result,compare)
26+

graalpython/lib-graalpython/itertools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ class combinations():
523523

524524
def __init__(self, pool, indices, r):
525525
self.pool = pool
526-
self.indices = range(indices)
526+
self.indices = indices
527527
if r < 0:
528528
raise ValueError("r must be non-negative")
529529
self.r = r
@@ -593,7 +593,7 @@ def __init__(self, iterable, r):
593593
if r < 0:
594594
raise ValueError("r must be non-negative")
595595
indices = [0] * r
596-
combinations.__init__(pool, indices, r)
596+
super().__init__(pool, indices, r)
597597
self.stopped = len(pool) == 0 and r > 0
598598

599599
def get_maximum(self, i):

graalpython/lib-python/3/venv/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def create_if_needed(d):
135135
if sys.platform == "win32":
136136
f.write(" %*")
137137
else:
138-
f.write(" $@")
138+
f.write(" \"$@\"")
139139

140140
if sys.platform != "win32":
141141
os.chmod(script, 0o777)

mx.graalpython/copyrights/overrides

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ graalpython/com.oracle.graal.python.test/src/tests/test_getattribute-bimorphic-i
233233
graalpython/com.oracle.graal.python.test/src/tests/test_getattribute-bimorphic-inobject.py,zippy.copyright
234234
graalpython/com.oracle.graal.python.test/src/tests/test_if-class-none.py,zippy.copyright
235235
graalpython/com.oracle.graal.python.test/src/tests/test_if.py,zippy.copyright
236+
graalpython/com.oracle.graal.python.test/src/tests/test_itertools.py,python.copyright
236237
graalpython/com.oracle.graal.python.test/src/tests/test_list.py,python.copyright
237238
graalpython/com.oracle.graal.python.test/src/tests/test_builtin.py,python.copyright
238239
graalpython/com.oracle.graal.python.test/src/tests/test_mandelbrot3.py,benchmarks.copyright

0 commit comments

Comments
 (0)