Provide a human readable exception for the percentage util (#47121)

pull/47128/head
J. Nick Koston 2021-02-26 18:33:13 -06:00 committed by GitHub
parent 84e01baa5a
commit 86f8cd8037
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -19,7 +19,7 @@ def ordered_list_item_to_percentage(ordered_list: List[str], item: str) -> int:
"""
if item not in ordered_list:
raise ValueError
raise ValueError(f'The item "{item}"" is not in "{ordered_list}"')
list_len = len(ordered_list)
list_position = ordered_list.index(item) + 1
@ -42,7 +42,7 @@ def percentage_to_ordered_list_item(ordered_list: List[str], percentage: int) ->
"""
list_len = len(ordered_list)
if not list_len:
raise ValueError
raise ValueError("The ordered list is empty")
for offset, speed in enumerate(ordered_list):
list_position = offset + 1