Skip to content

Commit

Permalink
Implement unary not on String
Browse files Browse the repository at this point in the history
  • Loading branch information
ankush981 committed Feb 6, 2016
1 parent 1f5b6ee commit ce96824
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 7 additions & 0 deletions python/common/org/python/types/Str.java
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,13 @@ public org.python.Object __pos__() {
public org.python.Object __neg__() {
throw new org.python.exceptions.TypeError("bad operand type for unary -: 'str'");
}

@org.python.Method(
__doc__=""
)
public org.python.Object __not__() {
return new org.python.types.Bool(this.value.length() == 0);
}

@org.python.Method(
__doc__ = ""
Expand Down
1 change: 0 additions & 1 deletion tests/datatypes/test_str.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class UnaryStrOperationTests(UnaryOperationTestCase, TranspileTestCase):
values = ['""', '"This is a string"']

not_implemented = [
'test_unary_not',
'test_unary_invert',
]

Expand Down

0 comments on commit ce96824

Please sign in to comment.