diff options
| author | Glenn Moloney <glenn.moloney@gmail.com> | 2025-02-25 14:36:29 +1100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2025-03-02 22:15:31 +1100 |
| commit | eb45d97898abd9aae93d0c953634cabb5ea327e3 (patch) | |
| tree | 17bc283a5f16724d6e4a3adf54eb7c0cb3b5b3cf /tests/misc/non_compliant.py | |
| parent | 69ffd2aaf09e35b68ea045872a63af6403fc1c8f (diff) | |
py/objstr: Support tuples and start/end args in startswith and endswith.
This change allows tuples to be passed as the prefix/suffix argument to the
`str.startswith()` and `str.endswith()` methods. The methods will return
`True` if the string starts/ends with any of the prefixes/suffixes in the
tuple.
Also adds full support for the `start` and `end` arguments to both methods
for compatibility with CPython.
Tests have been updated for the new behaviour.
Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
Diffstat (limited to 'tests/misc/non_compliant.py')
| -rw-r--r-- | tests/misc/non_compliant.py | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/tests/misc/non_compliant.py b/tests/misc/non_compliant.py index da90f90ac..dd62f6325 100644 --- a/tests/misc/non_compliant.py +++ b/tests/misc/non_compliant.py @@ -63,12 +63,6 @@ try: except NotImplementedError: print("NotImplementedError") -# str.endswith(s, start) not implemented -try: - "abc".endswith("c", 1) -except NotImplementedError: - print("NotImplementedError") - # str subscr with step!=1 not implemented try: print("abc"[1:2:3]) |
