Skip to content

Commit c894893

Browse files
committed
Add tests for loading plain array and NDData
1 parent 623f359 commit c894893

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/astro_image_display_api/widget_api_test.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,21 @@ def test_width_height(self):
7676
assert self.image.image_width == width
7777
assert self.image.image_height == height
7878

79-
def test_load(self, data, tmp_path):
80-
hdu = fits.PrimaryHDU(data=data)
81-
image_path = tmp_path / 'test.fits'
82-
hdu.header["BUNIT"] = "adu"
83-
hdu.writeto(image_path)
84-
self.image.load(image_path)
79+
@pytest.mark.parametrize("load_type", ["fits", "nddata", "array"])
80+
def test_load(self, data, tmp_path, load_type):
81+
match load_type:
82+
case "fits":
83+
hdu = fits.PrimaryHDU(data=data)
84+
image_path = tmp_path / 'test.fits'
85+
hdu.header["BUNIT"] = "adu"
86+
hdu.writeto(image_path)
87+
load_arg = image_path
88+
case "nddata":
89+
load_arg = NDData(data=data)
90+
case "array":
91+
load_arg = data
92+
93+
self.image.load(load_arg)
8594

8695
def test_center_on(self):
8796
self.image.center_on((10, 10)) # X, Y

0 commit comments

Comments
 (0)