summaryrefslogtreecommitdiff
path: root/tests/basics/bytes_strip.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-12-24 20:28:30 +0000
committerDamien George <damien.p.george@gmail.com>2014-12-24 20:28:30 +0000
commitc55a4d82cf03d22933028bd9db4031ef349fdc1f (patch)
tree82ee56795109357a08c34b5a210608034eedc1f6 /tests/basics/bytes_strip.py
parent7fdb8d78a47e7d78c93aba3f58cc83b92d0e1729 (diff)
py: Make bytes objs work with more str methods; add tests.
Diffstat (limited to 'tests/basics/bytes_strip.py')
-rw-r--r--tests/basics/bytes_strip.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/basics/bytes_strip.py b/tests/basics/bytes_strip.py
new file mode 100644
index 000000000..71e4ac185
--- /dev/null
+++ b/tests/basics/bytes_strip.py
@@ -0,0 +1,16 @@
+print(b"".strip())
+print(b" \t\n\r\v\f".strip())
+print(b" T E S T".strip())
+print(b"abcabc".strip(b"ce"))
+print(b"aaa".strip(b"b"))
+print(b"abc efg ".strip(b"g a"))
+
+print(b' spacious '.lstrip())
+print(b'www.example.com'.lstrip(b'cmowz.'))
+
+print(b' spacious '.rstrip())
+print(b'mississippi'.rstrip(b'ipz'))
+
+# Test that stripping unstrippable string returns original object
+s = b"abc"
+print(id(s.strip()) == id(s))