Skip to content

Commit

Permalink
Fix for test_isprintable_missing_cases
Browse files Browse the repository at this point in the history
beeware#36 related
  • Loading branch information
BPYap committed Feb 24, 2018
1 parent 104a65e commit d75ffb8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions python/common/org/python/types/Str.java
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,21 @@ public org.python.Object isprintable() {
if (!this.isCharPrintable(ch)) {
return new org.python.types.Bool(false);
}
// Every characters except space ' ' in the following categories are
// not printable:
// 0 - UNASSIGNED
// 12 - SPACE_SEPARATOR
// 13 - LINE_SEPARATOR
// 14 - PARAGRAPH_SEPARATOR
// 15 - CONTROL
// 16 - FORMAT
// 17 - PRIVATE_USE
// 18 - SURROGATE
else if((Character.getType(ch) == 0 ||
(Character.getType(ch) >= 12 && Character.getType(ch) <= 18))
&& ch != ' ') {
return new org.python.types.Bool(false);
}
}
return new org.python.types.Bool(true);
}
Expand Down

0 comments on commit d75ffb8

Please sign in to comment.