Skip to content

Commit

Permalink
fix: failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-reimann committed Jan 14, 2025
1 parent 81d5a4f commit 8c37532
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/safeds/data/image/containers/_empty_image_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def size_count(self) -> int:
return 0

def get_image(self, index: int) -> Image:
raise IndexOutOfBoundsError(index)
raise IndexOutOfBoundsError(f"There is no element at index '{index}'.")

def index(self, _image: Image) -> list[int]:
return []
Expand Down
4 changes: 2 additions & 2 deletions src/safeds/data/image/containers/_multi_size_image_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def size_count(self) -> int:

def get_image(self, index: int) -> Image:
if index not in self._indices_to_image_size_dict:
raise IndexOutOfBoundsError(index)
raise IndexOutOfBoundsError(f"There is no element at index '{index}'.")
return self._image_list_dict[self._indices_to_image_size_dict[index]].get_image(index)

def index(self, image: Image) -> list[int]:
Expand Down Expand Up @@ -282,7 +282,7 @@ def to_images(self, indices: list[int] | None = None) -> list[Image]:
if index not in self._indices_to_image_size_dict:
wrong_indices.append(index)
if len(wrong_indices) != 0:
raise IndexOutOfBoundsError(wrong_indices)
raise IndexOutOfBoundsError(f"There are no elements at indices {wrong_indices}.")
images = []
for index in indices:
images.append(self._image_list_dict[self._indices_to_image_size_dict[index]].get_image(index))
Expand Down
6 changes: 3 additions & 3 deletions src/safeds/data/image/containers/_single_size_image_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def _get_batch(self, batch_number: int, batch_size: int | None = None) -> Tensor
if batch_size is None:
batch_size = self._batch_size
if batch_size * batch_number >= len(self):
raise IndexOutOfBoundsError(batch_size * batch_number)
raise IndexOutOfBoundsError(f"There is no element at index '{batch_size * batch_number}'.")
max_index = batch_size * (batch_number + 1) if batch_size * (batch_number + 1) < len(self) else len(self)
return (
self._tensor[
Expand Down Expand Up @@ -311,7 +311,7 @@ def size_count(self) -> int:

def get_image(self, index: int) -> Image:
if index not in self._indices_to_tensor_positions:
raise IndexOutOfBoundsError(index)
raise IndexOutOfBoundsError(f"There is no element at index '{index}'.")
return Image(self._tensor[self._indices_to_tensor_positions[index]])

def index(self, image: Image) -> list[int]:
Expand Down Expand Up @@ -433,7 +433,7 @@ def to_images(self, indices: list[int] | None = None) -> list[Image]:
if index not in self._indices_to_tensor_positions:
wrong_indices.append(index)
if len(wrong_indices) != 0:
raise IndexOutOfBoundsError(wrong_indices)
raise IndexOutOfBoundsError(f"There are no elements at indices {wrong_indices}.")
return [Image(self._tensor[self._indices_to_tensor_positions[index]]) for index in indices]

def change_channel(self, channel: int) -> ImageList:
Expand Down

0 comments on commit 8c37532

Please sign in to comment.