diff options
author | Damien George <damien.p.george@gmail.com> | 2015-08-21 11:56:14 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-08-21 12:02:09 +0100 |
commit | d007cb890394d9d26c6fafb133532a5175d91eb2 (patch) | |
tree | 4fc76a836e7f9738d146bacac9b02f2e288c144b /tests/basics/string_rsplit.py | |
parent | d292a81e95bd558f3902f88fa4d6d5641a4aa388 (diff) | |
download | micropython-d007cb890394d9d26c6fafb133532a5175d91eb2.tar.gz micropython-d007cb890394d9d26c6fafb133532a5175d91eb2.zip |
tests: Add more tests to improve coverage, mostly testing exceptions.
Diffstat (limited to 'tests/basics/string_rsplit.py')
-rw-r--r-- | tests/basics/string_rsplit.py | 14 |
1 files changed, 13 insertions, 1 deletions
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")) |