summaryrefslogtreecommitdiff
path: root/tests/basics/string_endswith.py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-08-29 00:06:21 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-08-29 00:06:21 +0300
commit37379a2974190ab0fc97f840112d5a40c907368b (patch)
tree7c4d0ce9e82aa58ca8af5198a57f1e3211fb7a82 /tests/basics/string_endswith.py
parentc5c095690fc8294068e88c71baca92bf757ad91c (diff)
py/objstr: startswith, endswith: Check arg to be a string.
Otherwise, it will silently get incorrect result on other values types, including CPython tuple form like "foo.png".endswith(("png", "jpg")) (which MicroPython doesn't support for unbloatedness).
Diffstat (limited to 'tests/basics/string_endswith.py')
-rw-r--r--tests/basics/string_endswith.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/basics/string_endswith.py b/tests/basics/string_endswith.py
index 3e8fba925..683562d10 100644
--- a/tests/basics/string_endswith.py
+++ b/tests/basics/string_endswith.py
@@ -10,3 +10,8 @@ print("foobar".endswith("foobarbaz"))
#print("1foo".startswith("1foo", 1))
#print("1fo".startswith("foo", 1))
#print("1fo".startswith("foo", 10))
+
+try:
+ "foobar".endswith(1)
+except TypeError:
+ print("TypeError")