Skip to content

Commit b4b6597

Browse files
committed
Add tests for loading plain array and NDData
1 parent f3d50fe commit b4b6597

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
@@ -78,12 +78,21 @@ def test_width_height(self):
7878
assert self.image.image_width == width
7979
assert self.image.image_height == height
8080

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

8897
def test_center_on(self):
8998
self.image.center_on((10, 10)) # X, Y

0 commit comments

Comments
 (0)