From d007cb890394d9d26c6fafb133532a5175d91eb2 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 21 Aug 2015 11:56:14 +0100 Subject: tests: Add more tests to improve coverage, mostly testing exceptions. --- tests/basics/string_rsplit.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'tests/basics/string_rsplit.py') diff --git a/tests/basics/string_rsplit.py b/tests/basics/string_rsplit.py index cc6c0fd062..563b64f1c9 100644 --- a/tests/basics/string_rsplit.py +++ b/tests/basics/string_rsplit.py @@ -7,12 +7,24 @@ print("a b".rsplit()) #print(" a b c ".rsplit(None, 0)) #print(" a b c ".rsplit(None, -1)) -# empty separator should fail +# empty separator should fail (this actually delegates to .split()) try: "abc".rsplit('') except ValueError: print("ValueError") +# empty separator should fail (error handled in .rsplit()) +try: + 'a a a a'.rsplit('', 5) +except ValueError: + print('ValueError') + +# bad separator type +try: + 'a a a a'.rsplit(1) +except TypeError: + print('TypeError') + # non-empty separator print("abc".rsplit("a")) print("abc".rsplit("b")) -- cgit v1.2.3