Skip to content

Commit 456cc7b

Browse files
committed
Fix some terminology in stretch tests and add new test
1 parent a8a595e commit 456cc7b

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
1010
from astropy import units as u
1111
from astropy.wcs import WCS
12-
from astropy.visualization import AsymmetricPercentileInterval, LogStretch, ManualInterval
12+
from astropy.visualization import AsymmetricPercentileInterval, BaseInterval, BaseStretch, LogStretch, ManualInterval
1313

1414
__all__ = ['ImageWidgetAPITest']
1515

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

174-
with pytest.raises(ValueError, match='Multiple catalog styles defined'):
174+
with pytest.raises(ValueError, match='Multiple image labels defined'):
175175
self.image.get_viewport()
176176

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

233-
def test_set_get_view_port_no_image_label(self, data):
233+
def test_set_get_viewport_no_image_label(self, data):
234234
# If there is only one image, the viewport should be able to be set
235235
# and retrieved without an image label.
236236

@@ -686,6 +686,18 @@ def test_stretch_cuts_labels(self, data):
686686
assert isinstance(cuts, ManualInterval)
687687
assert cuts.get_limits(data) == (10, 100)
688688

689+
def test_stretch_cuts_are_set_after_loading_image(self, data):
690+
# Check that stretch and cuts are set to default values after loading an image
691+
self.image.load_image(data, image_label='test')
692+
693+
stretch = self.image.get_stretch(image_label='test')
694+
cuts = self.image.get_cuts(image_label='test')
695+
696+
# Backends can set whatever stretch and cuts they want, so
697+
# we just check that they are instances of the expected classes.
698+
assert isinstance(stretch, BaseStretch)
699+
assert isinstance(cuts, BaseInterval)
700+
689701
def test_stretch_cuts_errors(self, data):
690702
# Check that errors are raised when trying to get or set stretch or cuts
691703
# for an image label that does not exist.

0 commit comments

Comments
 (0)