summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/string_strip.py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-09-19 21:19:23 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-09-19 21:21:12 +0300
commitfc9a6dd09e77c34ef04bab57e73bfcb08bc78bb4 (patch)
treea56c911ef46a6ffdbf107023aba356a88f323e98 /tests/basics/string_strip.py
parent44f0a4d1e7a315c8d2b21fc4b0471d88e382a91e (diff)
downloadmicropython-fc9a6dd09e77c34ef04bab57e73bfcb08bc78bb4.tar.gz
micropython-fc9a6dd09e77c34ef04bab57e73bfcb08bc78bb4.zip
py/objstr: strip: Don't strip "\0" by default.
An issue was due to incorrectly taking size of default strip characters set.
Diffstat (limited to 'tests/basics/string_strip.py')
-rw-r--r--tests/basics/string_strip.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/basics/string_strip.py b/tests/basics/string_strip.py
index 5d99a78e51..971a4aae53 100644
--- a/tests/basics/string_strip.py
+++ b/tests/basics/string_strip.py
@@ -32,6 +32,13 @@ print("a ".strip())
print("a ".lstrip())
print("a ".rstrip())
+# \0 used to give a problem
+
+print("\0abc\0".strip())
+print("\0abc\0".lstrip())
+print("\0abc\0".rstrip())
+print("\0abc\0".strip("\0"))
+
# Test that stripping unstrippable string returns original object
s = "abc"
print(id(s.strip()) == id(s))