Skip to content

Commit 48b797c

Browse files
committed
Fix some terminology in stretch tests and add new test
1 parent ca34b4f commit 48b797c

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/astro_image_display_api/widget_api_test.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from astropy.table import Table, vstack # noqa: E402
1010
from astropy import units as u # noqa: E402
1111
from astropy.wcs import WCS # noqa: E402
12-
from astropy.visualization import AsymmetricPercentileInterval, LogStretch, ManualInterval
12+
from astropy.visualization import AsymmetricPercentileInterval, BaseInterval, BaseStretch, LogStretch, ManualInterval
1313

1414
__all__ = ['ImageWidgetAPITest']
1515

@@ -159,7 +159,7 @@ def test_set_get_viewport_errors(self, data, wcs):
159159
# If there are multiple images loaded, the image_label must be provided
160160
self.image.load_image(data, image_label='another test')
161161

162-
with pytest.raises(ValueError, match='Multiple catalog styles defined'):
162+
with pytest.raises(ValueError, match='Multiple image labels defined'):
163163
self.image.get_viewport()
164164

165165
# setting sky_or_pixel to something other than 'sky' or 'pixel' or None
@@ -218,7 +218,7 @@ def test_viewport_is_defined_after_loading_image(self, tmp_path, data, wcs, worl
218218
# fov should be a float since no WCS
219219
assert isinstance(vport['fov'], numbers.Real)
220220

221-
def test_set_get_view_port_no_image_label(self, data):
221+
def test_set_get_viewport_no_image_label(self, data):
222222
# If there is only one image, the viewport should be able to be set
223223
# and retrieved without an image label.
224224

@@ -530,6 +530,18 @@ def test_stretch_cuts_labels(self, data):
530530
assert isinstance(cuts, ManualInterval)
531531
assert cuts.get_limits(data) == (10, 100)
532532

533+
def test_stretch_cuts_are_set_after_loading_image(self, data):
534+
# Check that stretch and cuts are set to default values after loading an image
535+
self.image.load_image(data, image_label='test')
536+
537+
stretch = self.image.get_stretch(image_label='test')
538+
cuts = self.image.get_cuts(image_label='test')
539+
540+
# Backends can set whatever stretch and cuts they want, so
541+
# we just check that they are instances of the expected classes.
542+
assert isinstance(stretch, BaseStretch)
543+
assert isinstance(cuts, BaseInterval)
544+
533545
def test_stretch_cuts_errors(self, data):
534546
# Check that errors are raised when trying to get or set stretch or cuts
535547
# for an image label that does not exist.

0 commit comments

Comments
 (0)