|
9 | 9 | from astropy.table import Table, vstack |
10 | 10 | from astropy import units as u |
11 | 11 | from astropy.wcs import WCS |
12 | | -from astropy.visualization import AsymmetricPercentileInterval, LogStretch, ManualInterval |
| 12 | +from astropy.visualization import AsymmetricPercentileInterval, BaseInterval, BaseStretch, LogStretch, ManualInterval |
13 | 13 |
|
14 | 14 | __all__ = ['ImageWidgetAPITest'] |
15 | 15 |
|
@@ -171,7 +171,7 @@ def test_set_get_viewport_errors(self, data, wcs): |
171 | 171 | # If there are multiple images loaded, the image_label must be provided |
172 | 172 | self.image.load_image(data, image_label='another test') |
173 | 173 |
|
174 | | - with pytest.raises(ValueError, match='Multiple catalog styles defined'): |
| 174 | + with pytest.raises(ValueError, match='Multiple image labels defined'): |
175 | 175 | self.image.get_viewport() |
176 | 176 |
|
177 | 177 | # 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 |
230 | 230 | # fov should be a float since no WCS |
231 | 231 | assert isinstance(vport['fov'], numbers.Real) |
232 | 232 |
|
233 | | - def test_set_get_view_port_no_image_label(self, data): |
| 233 | + def test_set_get_viewport_no_image_label(self, data): |
234 | 234 | # If there is only one image, the viewport should be able to be set |
235 | 235 | # and retrieved without an image label. |
236 | 236 |
|
@@ -686,6 +686,18 @@ def test_stretch_cuts_labels(self, data): |
686 | 686 | assert isinstance(cuts, ManualInterval) |
687 | 687 | assert cuts.get_limits(data) == (10, 100) |
688 | 688 |
|
| 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 | + |
689 | 701 | def test_stretch_cuts_errors(self, data): |
690 | 702 | # Check that errors are raised when trying to get or set stretch or cuts |
691 | 703 | # for an image label that does not exist. |
|
0 commit comments