Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise more unknown length cases #48

Merged
merged 2 commits into from
Jan 17, 2017
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: 1 addition & 1 deletion kenjutsu/measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def len_slice(a_slice, a_length=None):
if (new_slice.step > 0 and new_slice.start >= 0 and
(new_slice.stop is None or new_slice.stop < 0)):
raise UnknownSliceLengthException(
"Cannot determine slice length without a defined start"
"Cannot determine slice length without a defined end"
" point. The reformatted slice was %s." % repr(new_slice)
)
elif (new_slice.step < 0 and new_slice.start < 0 and
Expand Down
6 changes: 6 additions & 0 deletions tests/test_measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,15 @@ def test_len_slice(self):
with self.assertRaises(measure.UnknownSliceLengthException):
measure.len_slice(slice(None))

with self.assertRaises(measure.UnknownSliceLengthException):
measure.len_slice(slice(0, -1, 1))

with self.assertRaises(measure.UnknownSliceLengthException):
measure.len_slice(slice(None, None, -1))

with self.assertRaises(measure.UnknownSliceLengthException):
measure.len_slice(slice(-1, 1, -1))

for size in [10, 11, 12]:
excess = size + 3
each_range = range(size)
Expand Down