Skip to content

Commit 9c674f2

Browse files
committed
Address review comments
1 parent 8dfda13 commit 9c674f2

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

src/astro_image_display_api/api_test.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -801,20 +801,24 @@ def test_save_overwrite(self, tmp_path):
801801
def test_get_image_labels(self, data):
802802
# the test viewer begins with a default empty image
803803
assert len(self.image.get_image_labels()) == 1
804-
assert self.image.get_image_labels()[0] == None
804+
assert self.image.get_image_labels()[0] is None
805805
assert isinstance(self.image.get_image_labels(), tuple)
806806

807807
self.image.load_image(data, image_label="test")
808808
assert len(self.image.get_image_labels()) == 2
809-
assert self.image.get_image_labels()[-1] == 'test'
809+
assert self.image.get_image_labels()[-1] == "test"
810810

811811
def test_get_image(self, data):
812812
self.image.load_image(data, image_label="test")
813813

814814
# currently the type is not specified in the API
815815
assert self.image.get_image() is not None
816816
assert self.image.get_image(image_label="test") is not None
817-
817+
818+
retrieved_image = self.image.get_image(image_label="test")
819+
820+
self.image.load_image(retrieved_image, image_label="another test")
821+
assert self.image.get_image(image_label="another test") is not None
822+
818823
with pytest.raises(ValueError, match="[Ii]mage label.*not found"):
819824
self.image.get_image(image_label="not a valid label")
820-

src/astro_image_display_api/interface_definition.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@ def get_image(
6060
The label of the image to set the cuts for. If not given and there is
6161
only one image loaded, that image is returned.
6262
63-
Raises
64-
------
65-
ValueError
66-
If the `image_label` is not provided when there are multiple images loaded,
67-
or if the `image_label` does not correspond to a loaded image.
68-
6963
Returns
7064
-------
7165
image_data : Any
@@ -74,13 +68,20 @@ def get_image(
7468
with `astropy.nddata.NDData` is preferred, but not required. It is expected
7569
that the returned data can be re-loaded into the viewer using
7670
`load_image`, however.
71+
72+
Raises
73+
------
74+
ValueError
75+
If the `image_label` is not provided when there are multiple images loaded,
76+
or if the `image_label` does not correspond to a loaded image.
77+
7778
"""
7879
raise NotImplementedError
79-
80+
8081
@abstractmethod
8182
def get_image_labels(
8283
self,
83-
) -> tuple[str]:
84+
) -> tuple[str]:
8485
"""
8586
Get the labels of the loaded images.
8687

0 commit comments

Comments
 (0)