Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixing error message so it matches one from python3.4
  • Loading branch information
kellrott committed May 28, 2019
commit 2f4feef9522af3a34fc2b5fa300dd744e5a1c148
2 changes: 1 addition & 1 deletion py/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func init() {
} else if _, ok := value.(NoneType); ok {
valArray = fieldsN(string(selfStr), maxSplit)
} else {
return nil, ExceptionNewf(TypeError, "descriptor 'split' requires a 'str' object but received a '%s'", value.Type())
return nil, ExceptionNewf(TypeError, "must be str or None, not %s", value.Type())
}
o := List{}
for _, j := range valArray {
Expand Down
2 changes: 1 addition & 1 deletion py/tests/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class C():
assert ['a', 'd,c'] == list("a,d,c".split(",",1))
assert ['a', 'd', 'b'] == list(" a d b ".split())
assert ['a', 'd b '] == list(" a d b ".split(None, 1))
assertRaisesText(TypeError, "descriptor 'split' requires a 'str' object but received a 'int'", lambda: "0,1,2,4".split(1))
assertRaisesText(TypeError, "must be str or None, not int", lambda: "0,1,2,4".split(1))

doc="ascii len"
assert len(asc) == 5
Expand Down