Skip to content

Commit 65e9374

Browse files
committed
[GR-23255][GR-23259] get test_range test_slice to pass
PullRequest: graalpython/1099
2 parents 00f197c + 019155e commit 65e9374

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2861
-1132
lines changed

graalpython/com.oracle.graal.python.test/src/com/oracle/graal/python/test/datatype/PRangeTests.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import static com.oracle.graal.python.test.PythonTests.assertPrints;
2929
import static org.junit.Assert.assertEquals;
3030

31+
import com.oracle.graal.python.builtins.objects.range.PIntRange;
3132
import org.junit.Before;
3233
import org.junit.Test;
3334

@@ -67,7 +68,7 @@ public void doInsert(Node child) {
6768

6869
@Test
6970
public void loopWithOnlyStop() throws UnexpectedResultException {
70-
PRange range = PythonObjectFactory.getUncached().createRange(10);
71+
PRange range = PythonObjectFactory.getUncached().createIntRange(10);
7172
int index = 0;
7273
TestRoot testRoot = new TestRoot(PythonLanguage.getCurrent());
7374
GetIteratorNode getIter = GetIteratorNode.create();
@@ -91,7 +92,7 @@ public void loopWithOnlyStop() throws UnexpectedResultException {
9192

9293
@Test
9394
public void loopWithStep() throws UnexpectedResultException {
94-
PRange range = PythonObjectFactory.getUncached().createRange(0, 10, 2);
95+
PRange range = PythonObjectFactory.getUncached().createIntRange(0, 10, 2, 5);
9596
int index = 0;
9697
TestRoot testRoot = new TestRoot(PythonLanguage.getCurrent());
9798
GetIteratorNode getIter = GetIteratorNode.create();
@@ -115,8 +116,8 @@ public void loopWithStep() throws UnexpectedResultException {
115116

116117
@Test
117118
public void getItem() {
118-
PRange range = PythonObjectFactory.getUncached().createRange(10);
119-
assertEquals(3, range.getItemNormalized(3));
119+
PIntRange range = PythonObjectFactory.getUncached().createIntRange(10);
120+
assertEquals(3, range.getIntItemNormalized(3));
120121
}
121122

122123
@Test

graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_range.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
*graalpython.lib-python.3.test.test_range.RangeTest.test_attributes
2+
*graalpython.lib-python.3.test.test_range.RangeTest.test_comparison
3+
*graalpython.lib-python.3.test.test_range.RangeTest.test_contains
4+
*graalpython.lib-python.3.test.test_range.RangeTest.test_count
25
*graalpython.lib-python.3.test.test_range.RangeTest.test_empty
6+
*graalpython.lib-python.3.test.test_range.RangeTest.test_exhausted_iterator_pickling
7+
*graalpython.lib-python.3.test.test_range.RangeTest.test_index
38
*graalpython.lib-python.3.test.test_range.RangeTest.test_invalid_invocation
49
*graalpython.lib-python.3.test.test_range.RangeTest.test_issue11845
510
*graalpython.lib-python.3.test.test_range.RangeTest.test_iterator_pickling
611
*graalpython.lib-python.3.test.test_range.RangeTest.test_large_exhausted_iterator_pickling
12+
*graalpython.lib-python.3.test.test_range.RangeTest.test_large_operands
13+
*graalpython.lib-python.3.test.test_range.RangeTest.test_large_range
714
*graalpython.lib-python.3.test.test_range.RangeTest.test_odd_bug
815
*graalpython.lib-python.3.test.test_range.RangeTest.test_pickling
916
*graalpython.lib-python.3.test.test_range.RangeTest.test_range
10-
*graalpython.lib-python.3.test.test_range.RangeTest.test_range_iterators_invocation
11-
*graalpython.lib-python.3.test.test_range.RangeTest.test_repr
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1+
*graalpython.lib-python.3.test.test_slice.SliceTest.test_cmp
12
*graalpython.lib-python.3.test.test_slice.SliceTest.test_constructor
3+
*graalpython.lib-python.3.test.test_slice.SliceTest.test_cycle
4+
*graalpython.lib-python.3.test.test_slice.SliceTest.test_hash
5+
*graalpython.lib-python.3.test.test_slice.SliceTest.test_indices
6+
*graalpython.lib-python.3.test.test_slice.SliceTest.test_members
7+
*graalpython.lib-python.3.test.test_slice.SliceTest.test_pickle
28
*graalpython.lib-python.3.test.test_slice.SliceTest.test_repr
9+
*graalpython.lib-python.3.test.test_slice.SliceTest.test_setslice_without_getslice

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/PythonBuiltinClassType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public enum PythonBuiltinClassType implements LazyPythonClass {
9696
PNone("NoneType"),
9797
PNotImplemented("NotImplementedType"),
9898
PRandom("Random", "_random"),
99-
PRange("range", BuiltinNames.BUILTINS),
99+
PRange("range", BuiltinNames.BUILTINS, false),
100100
PReferenceType("ReferenceType", "_weakref"),
101101
PSentinelIterator("callable_iterator"),
102102
PForeignArrayIterator("foreign_iterator"),

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/ArrayModuleBuiltins.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
import com.oracle.graal.python.builtins.objects.array.PArray;
4040
import com.oracle.graal.python.builtins.objects.common.SequenceNodes;
4141
import com.oracle.graal.python.builtins.objects.common.SequenceStorageNodes;
42-
import com.oracle.graal.python.builtins.objects.range.PRange;
42+
import com.oracle.graal.python.builtins.objects.range.PIntRange;
4343
import com.oracle.graal.python.nodes.ErrorMessages;
4444
import com.oracle.graal.python.nodes.control.GetIteratorExpressionNode.GetIteratorNode;
4545
import com.oracle.graal.python.nodes.control.GetNextNode;
@@ -78,16 +78,16 @@ PArray array(Object cls, String typeCode, @SuppressWarnings("unused") PNone init
7878
}
7979

8080
@Specialization
81-
PArray arrayWithRangeInitializer(Object cls, String typeCode, PRange range) {
81+
PArray arrayWithRangeInitializer(Object cls, String typeCode, PIntRange range) {
8282
if (!typeCode.equals("i")) {
8383
typeError(typeCode, range);
8484
}
8585

86-
int[] intArray = new int[range.len()];
86+
int[] intArray = new int[range.getIntLength()];
8787

88-
int start = range.getStart();
89-
int stop = range.getStop();
90-
int step = range.getStep();
88+
int start = range.getIntStart();
89+
int stop = range.getIntStop();
90+
int step = range.getIntStep();
9191

9292
int index = 0;
9393
for (int i = start; i < stop; i += step) {

0 commit comments

Comments
 (0)