Skip to content

Commit

Permalink
Fix len() for bytes, bytearray
Browse files Browse the repository at this point in the history
  • Loading branch information
ASP1234 committed Mar 12, 2017
1 parent 4823682 commit 9b6a333
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion python/common/org/python/types/ByteArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ public org.python.Iterable __iter__(java.util.List<org.python.Object> args, java
@org.python.Method(
__doc__ = ""
)
public org.python.types.Int __len__(java.util.List<org.python.Object> args, java.util.Map<java.lang.String, org.python.Object> kwargs, java.util.List<org.python.Object> default_args, java.util.Map<java.lang.String, org.python.Object> default_kwargs) {
public org.python.types.Int __len__() {
return new org.python.types.Int(this.value.length);
}

Expand Down
2 changes: 1 addition & 1 deletion python/common/org/python/types/Bytes.java
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ public org.python.Iterable __iter__(java.util.List<org.python.Object> args, java
@org.python.Method(
__doc__ = ""
)
public org.python.types.Int __len__(java.util.List<org.python.Object> args, java.util.Map<java.lang.String, org.python.Object> kwargs, java.util.List<org.python.Object> default_args, java.util.Map<java.lang.String, org.python.Object> default_kwargs) {
public org.python.types.Int __len__() {
return new org.python.types.Int(this.value.length);
}

Expand Down
3 changes: 0 additions & 3 deletions tests/builtins/test_len.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,5 @@ class BuiltinLenFunctionTests(BuiltinFunctionTestCase, TranspileTestCase):
functions = ["len"]

not_implemented = [
'test_bytearray',
'test_bytes',
'test_class',
'test_frozenset',
]
2 changes: 1 addition & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ def wrapper(*args, **kwargs):
],
'set': [
'set()',
'{1, 2.3456, "another"}',
'set({1, 2.3456, "another"})',
],
'slice': [
'slice(0)',
Expand Down

0 comments on commit 9b6a333

Please sign in to comment.