Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions modules/50-loops/29-edge-cases/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ def is_arguments_for_substr_correct(string, index, length):
return False
elif length < 0:
return False
elif index > len(string) - 1:
return False
elif index + length > len(string):
return False
return True
7 changes: 4 additions & 3 deletions modules/50-loops/29-edge-cases/test_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@

def test1():
string = "Sansa Stark"
end = len(string) - 1
end = len(string)
assert not index.is_arguments_for_substr_correct(string, -1, 0)
assert not index.is_arguments_for_substr_correct(string, 0, -1)
assert not index.is_arguments_for_substr_correct(string, end + 1, 0)
assert not index.is_arguments_for_substr_correct(string, end, 5)
assert index.is_arguments_for_substr_correct(string, end, 1)
assert not index.is_arguments_for_substr_correct(string, end, 1)
assert index.is_arguments_for_substr_correct(string, end, 0)
assert index.is_arguments_for_substr_correct(string, end - 1, 1)
assert index.is_arguments_for_substr_correct(string, 3, 3)
assert index.is_arguments_for_substr_correct(string, 0, 3)
assert index.is_arguments_for_substr_correct(string, 0, 1)
Expand Down