From fc9a6dd09e77c34ef04bab57e73bfcb08bc78bb4 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Tue, 19 Sep 2017 21:19:23 +0300 Subject: py/objstr: strip: Don't strip "\0" by default. An issue was due to incorrectly taking size of default strip characters set. --- tests/basics/string_strip.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') diff --git a/tests/basics/string_strip.py b/tests/basics/string_strip.py index 5d99a78e5..971a4aae5 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)) -- cgit v1.2.3