From 65365778fd40bddddab83e3593da9b88992824ef Mon Sep 17 00:00:00 2001 From: xbe Date: Thu, 30 Jan 2014 22:16:47 -0800 Subject: Add tests for str.strip --- tests/basics/string_strip.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 tests/basics/string_strip.py (limited to 'tests') diff --git a/tests/basics/string_strip.py b/tests/basics/string_strip.py new file mode 100644 index 000000000..518dfd66e --- /dev/null +++ b/tests/basics/string_strip.py @@ -0,0 +1,6 @@ +print("".strip()) +print(" \t\n\r\v\f".strip()) +print(" T E S T".strip()) +print("abcabc".strip("ce")) +print("aaa".strip("b")) +print("abc efg ".strip("g a")) -- cgit v1.2.3 From 480c15afb52adbb01a257eb4d533bac627eafeb2 Mon Sep 17 00:00:00 2001 From: xbe Date: Thu, 30 Jan 2014 22:17:30 -0800 Subject: Implement str.replace and add tests for it. --- tests/basics/string_replace.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 tests/basics/string_replace.py (limited to 'tests') diff --git a/tests/basics/string_replace.py b/tests/basics/string_replace.py new file mode 100644 index 000000000..a1d0f973b --- /dev/null +++ b/tests/basics/string_replace.py @@ -0,0 +1,8 @@ +print("".replace("a", "b")) +print("aaa".replace("a", "b", 0)) +print("aaa".replace("a", "b", -5)) +print("asdfasdf".replace("a", "b")) +print("aabbaabbaabbaa".replace("aa", "cc", 3)) +print("a".replace("aa", "bb")) +print("testingtesting".replace("ing", "")) +print("testINGtesting".replace("ing", "ING!")) -- cgit v1.2.3