|
9 | 9 | from astropy.table import Table, vstack # noqa: E402 |
10 | 10 | from astropy import units as u # noqa: E402 |
11 | 11 | 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 |
13 | 13 |
|
14 | 14 | __all__ = ['ImageWidgetAPITest'] |
15 | 15 |
|
@@ -159,7 +159,7 @@ def test_set_get_viewport_errors(self, data, wcs): |
159 | 159 | # If there are multiple images loaded, the image_label must be provided |
160 | 160 | self.image.load_image(data, image_label='another test') |
161 | 161 |
|
162 | | - with pytest.raises(ValueError, match='Multiple catalog styles defined'): |
| 162 | + with pytest.raises(ValueError, match='Multiple image labels defined'): |
163 | 163 | self.image.get_viewport() |
164 | 164 |
|
165 | 165 | # 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 |
218 | 218 | # fov should be a float since no WCS |
219 | 219 | assert isinstance(vport['fov'], numbers.Real) |
220 | 220 |
|
221 | | - def test_set_get_view_port_no_image_label(self, data): |
| 221 | + def test_set_get_viewport_no_image_label(self, data): |
222 | 222 | # If there is only one image, the viewport should be able to be set |
223 | 223 | # and retrieved without an image label. |
224 | 224 |
|
@@ -530,6 +530,18 @@ def test_stretch_cuts_labels(self, data): |
530 | 530 | assert isinstance(cuts, ManualInterval) |
531 | 531 | assert cuts.get_limits(data) == (10, 100) |
532 | 532 |
|
| 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 | + |
533 | 545 | def test_stretch_cuts_errors(self, data): |
534 | 546 | # Check that errors are raised when trying to get or set stretch or cuts |
535 | 547 | # for an image label that does not exist. |
|
0 commit comments