Skip to content

Commit

Permalink
Updated AstroImage tests to account for new method signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffenhir authored and schmelly committed Dec 30, 2023
1 parent 73e06a8 commit 5db3e26
Showing 1 changed file with 5 additions and 23 deletions.
28 changes: 5 additions & 23 deletions tests/test_AstroImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,9 @@

file_types = ["16 bit Fits", "32 bit Fits", "16 bit Tiff", "32 bit Tiff", "16 bit XISF", "32 bit XISF"]


class DummyStretchOption:
def get(self):
return "30% Bg, 2 sigma"
saturation = 2.0
stretch = "30% Bg, 2 sigma"

class DummySaturationOption:
def get(self):
return 2.0



def test_set_from_array_mono():
Expand Down Expand Up @@ -78,8 +72,6 @@ def test_set_from_file_color(img):


def test_update_display_mono():
stretch = DummyStretchOption()
saturation = DummySaturationOption()
a = AstroImage(do_update_display=False)

a.set_from_array(array_mono)
Expand All @@ -88,8 +80,6 @@ def test_update_display_mono():
assert np.asarray(a.img_display_saturated).shape == (5,6)

def test_update_display_color():
stretch = DummyStretchOption()
saturation = DummySaturationOption()
a = AstroImage(do_update_display=False)

a.set_from_array(array_color)
Expand All @@ -100,8 +90,6 @@ def test_update_display_color():

@pytest.mark.parametrize("file_type", file_types)
def test_save_mono(tmp_path, file_type):
stretch = DummyStretchOption()
saturation = DummySaturationOption()
a = AstroImage()

a.set_from_file("./tests/test_images/mono_32bit.fits", stretch, saturation)
Expand Down Expand Up @@ -131,8 +119,6 @@ def test_save_mono(tmp_path, file_type):

@pytest.mark.parametrize("file_type", file_types)
def test_save_color(tmp_path, file_type):
stretch = DummyStretchOption()
saturation = DummySaturationOption()
a = AstroImage()

a.set_from_file("./tests/test_images/color_32bit.fits", stretch, saturation)
Expand Down Expand Up @@ -161,14 +147,12 @@ def test_save_color(tmp_path, file_type):

@pytest.mark.parametrize("file_type", file_types)
def test_save_stretched_mono(tmp_path, file_type):
stretch = DummyStretchOption()
saturation = DummySaturationOption()
a = AstroImage()

a.set_from_file("./tests/test_images/mono_32bit.fits", stretch, saturation)
file_ending = file_type[-4::].lower()
file_dir = os.path.join(tmp_path, file_type + "." + file_ending)
a.save_stretched(file_dir, file_type)
a.save_stretched(file_dir, file_type, stretch)

if file_ending == "fits":
hdul = fits.open(file_dir)
Expand All @@ -192,14 +176,12 @@ def test_save_stretched_mono(tmp_path, file_type):

@pytest.mark.parametrize("file_type", file_types)
def test_save_stretched_color(tmp_path, file_type):
stretch = DummyStretchOption()
saturation = DummySaturationOption()
a = AstroImage(stretch,saturation)
a = AstroImage()

a.set_from_file("./tests/test_images/color_32bit.fits", stretch, saturation)
file_ending = file_type[-4::].lower()
file_dir = os.path.join(tmp_path, file_type + "." + file_ending)
a.save_stretched(file_dir, file_type)
a.save_stretched(file_dir, file_type, stretch)

if file_ending == "fits":
hdul = fits.open(file_dir)
Expand Down

0 comments on commit 5db3e26

Please sign in to comment.