Skip to content

Commit

Permalink
test_subscr_bool
Browse files Browse the repository at this point in the history
  • Loading branch information
hwrdch committed Nov 23, 2017
1 parent 943e4d4 commit 009f3a4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 4 additions & 1 deletion python/common/org/python/types/Str.java
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,10 @@ public org.python.Object __getitem__(org.python.Object index) {
throw new org.python.exceptions.IndexError("string index out of range");
} else {
if (slice) {
sliced = this.value.substring(1, 2);
if (this.value.length() < 2)
throw new org.python.exceptions.IndexError("string index out of range");
else
sliced = this.value.substring(1, 2);
} else {
sliced = this.value.substring(0, 1);
}
Expand Down
2 changes: 0 additions & 2 deletions tests/datatypes/test_str.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,8 +774,6 @@ class BinaryStrOperationTests(BinaryOperationTestCase, TranspileTestCase):

not_implemented = [
'test_modulo_class',

'test_subscr_bool',
'test_subscr_slice',
]

Expand Down

0 comments on commit 009f3a4

Please sign in to comment.