Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
55b11e6d
Commit
55b11e6d
authored
Sep 04, 2015
by
Damien George
Browse files
py/objstr: For str.endswith(s, start) raise NotImpl instead of assert.
parent
0b7a66ab
Changes
3
Hide whitespace changes
Inline
Side-by-side
py/objstr.c
View file @
55b11e6d
...
...
@@ -699,7 +699,9 @@ STATIC mp_obj_t str_startswith(mp_uint_t n_args, const mp_obj_t *args) {
STATIC
mp_obj_t
str_endswith
(
mp_uint_t
n_args
,
const
mp_obj_t
*
args
)
{
GET_STR_DATA_LEN
(
args
[
0
],
str
,
str_len
);
GET_STR_DATA_LEN
(
args
[
1
],
suffix
,
suffix_len
);
assert
(
n_args
==
2
);
if
(
n_args
>
2
)
{
mp_not_implemented
(
"start/end indices"
);
}
if
(
suffix_len
>
str_len
)
{
return
mp_const_false
;
...
...
tests/misc/non_compliant.py
View file @
55b11e6d
...
...
@@ -52,6 +52,12 @@ try:
except
NotImplementedError
:
print
(
'NotImplementedError'
)
# str.endswith(s, start) not implemented
try
:
'abc'
.
endswith
(
'c'
,
1
)
except
NotImplementedError
:
print
(
'NotImplementedError'
)
# bytes(...) with keywords not implemented
try
:
bytes
(
'abc'
,
encoding
=
'utf8'
)
...
...
tests/misc/non_compliant.py.exp
View file @
55b11e6d
...
...
@@ -8,3 +8,4 @@ NotImplementedError
NotImplementedError
NotImplementedError
NotImplementedError
NotImplementedError
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment