Skip to content

Commit 9baba2b

Browse files
committed
Remove tests that are part of the API test now
1 parent aa84748 commit 9baba2b

File tree

1 file changed

+0
-157
lines changed

1 file changed

+0
-157
lines changed

astrowidgets/tests/test_image_widget.py

Lines changed: 0 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -42,60 +42,6 @@ def _make_fake_ccd(with_wcs=True):
4242
return CCDData(data=fake_image, wcs=wcs, unit='adu')
4343

4444

45-
def test_setting_image_width_height(): # yep
46-
image = ImageWidget()
47-
width = 200
48-
height = 300
49-
image.image_width = width
50-
image.image_height = height
51-
assert image._viewer.get_window_size() == (width, height)
52-
53-
54-
def test_add_marker_does_not_modify_input_table(): # in test_marking_operations
55-
# Regression test for #45
56-
# Adding markers should not modify the input data table
57-
image = ImageWidget(image_width=300, image_height=300,
58-
pixel_coords_offset=5)
59-
data = np.random.random([300, 300])
60-
image.load_array(data)
61-
x = [20, 30, 40]
62-
y = [40, 80, 100]
63-
# Create two separate tables for comparison after add_markers.
64-
orig_table = Table(data=[x, y], names=['x', 'y'])
65-
in_table = Table(data=[x, y], names=['x', 'y'])
66-
image.add_markers(in_table)
67-
assert (in_table == orig_table).all()
68-
69-
70-
def test_adding_markers_as_world_recovers_with_get_markers(): # yep
71-
"""
72-
Make sure that our internal conversion from world to pixel
73-
coordinates doesn't mess anything up.
74-
"""
75-
fake_ccd = _make_fake_ccd(with_wcs=True)
76-
npix_side = fake_ccd.shape[0]
77-
wcs = fake_ccd.wcs
78-
iw = ImageWidget(pixel_coords_offset=0)
79-
iw.load_nddata(fake_ccd)
80-
# Get me 100 positions please, not right at the edge
81-
marker_locs = np.random.randint(10,
82-
high=npix_side - 10,
83-
size=(100, 2))
84-
marks_pix = Table(data=marker_locs, names=['x', 'y'])
85-
marks_world = wcs.all_pix2world(marker_locs, 0)
86-
marks_coords = SkyCoord(marks_world, unit='degree')
87-
mark_coord_table = Table(data=[marks_coords], names=['coord'])
88-
iw.add_markers(mark_coord_table, use_skycoord=True)
89-
result = iw.get_markers()
90-
# Check the x, y positions as long as we are testing things...
91-
np.testing.assert_allclose(result['x'], marks_pix['x'])
92-
np.testing.assert_allclose(result['y'], marks_pix['y'])
93-
np.testing.assert_allclose(result['coord'].ra.deg,
94-
mark_coord_table['coord'].ra.deg)
95-
np.testing.assert_allclose(result['coord'].dec.deg,
96-
mark_coord_table['coord'].dec.deg)
97-
98-
9945
def test_can_set_pixel_offset_at_object_level():
10046
# The pixel offset below is nonsensical. It is chosen simply
10147
# to make it easy to check for.
@@ -128,73 +74,6 @@ def test_move_callback_includes_offset():
12874
assert float(y_out) == data_y + offset
12975

13076

131-
def test_can_add_markers_with_names(): # in test_marking_operations?
132-
"""
133-
Test a few things related to naming marker sets
134-
"""
135-
npix_side = 200
136-
image = ImageWidget(image_width=npix_side,
137-
image_height=npix_side)
138-
x = np.array([20, 30, 40])
139-
y = np.array([40, 80, 100])
140-
141-
# This should succeed without error
142-
image.add_markers(Table(data=[x, y], names=['x', 'y']),
143-
marker_name='nonsense')
144-
145-
# The name 'nonsense', and nothing else, should be in the
146-
# set of markers.
147-
assert set(['nonsense']) == image._marktags
148-
149-
# Add more markers with the same name
150-
# This should succeed without error
151-
image.add_markers(Table(data=[x, y], names=['x', 'y']),
152-
marker_name='nonsense')
153-
154-
# check that we get the right number of markers
155-
marks = image.get_markers(marker_name='nonsense')
156-
assert len(marks) == 6
157-
158-
# Make sure setting didn't change the default name
159-
assert image._default_mark_tag_name == 'default-marker-name'
160-
161-
# Try adding markers without a name
162-
image.add_markers(Table(data=[x, y], names=['x', 'y']))
163-
assert image._marktags == set(['nonsense', image._default_mark_tag_name])
164-
165-
# Delete just the nonsense markers
166-
image.remove_markers('nonsense')
167-
168-
assert 'nonsense' not in image._marktags
169-
assert image._default_mark_tag_name in image._marktags
170-
171-
# Add the nonsense markers back...
172-
image.add_markers(Table(data=[x, y], names=['x', 'y']),
173-
marker_name='nonsense')
174-
# ...and now delete all of the markers
175-
image.reset_markers()
176-
# We should have no markers on the image
177-
assert image._marktags == set()
178-
179-
# Simulate a mouse click and make sure the expected marker
180-
# name has been added.
181-
data_x = 50
182-
data_y = 50
183-
image._is_marking = True
184-
image._mouse_click_cb(image._viewer, None, data_x, data_y)
185-
assert image._interactive_marker_set_name in image._marktags
186-
187-
188-
def test_mark_with_reserved_name_raises_error(): # in test_marking_operations
189-
npix_side = 200
190-
image = ImageWidget(image_width=npix_side,
191-
image_height=npix_side)
192-
x = np.array([20, 30, 40])
193-
y = np.array([40, 80, 100])
194-
for name in RESERVED_MARKER_SET_NAMES:
195-
with pytest.raises(ValueError):
196-
image.add_markers(Table(data=[x, y], names=['x', 'y']),
197-
marker_name=name)
19877

19978

20079
def test_get_marker_with_names():
@@ -258,23 +137,6 @@ def test_unknown_marker_name_error():
258137
assert f"No markers named '{bad_name}'" in str(e.value)
259138

260139

261-
def test_marker_name_has_no_marks_warning(): # in test_marking_operations
262-
"""
263-
Regression test for https://github.com/astropy/astrowidgets/issues/97
264-
265-
This particular test checks that getting an empty table gives a
266-
useful warning message.
267-
"""
268-
iw = ImageWidget()
269-
bad_name = 'empty marker set'
270-
iw.start_marking(marker_name=bad_name)
271-
272-
with pytest.warns(UserWarning) as record:
273-
iw.get_markers(marker_name=bad_name)
274-
275-
assert f"Marker set named '{bad_name}' is empty" in str(record[0].message)
276-
277-
278140
def test_empty_marker_name_works_with_all():
279141
"""
280142
Regression test for https://github.com/astropy/astrowidgets/issues/97
@@ -299,22 +161,3 @@ def test_empty_marker_name_works_with_all():
299161
marks = iw.get_markers(marker_name='all')
300162
assert len(marks) == len(x)
301163
assert 'empty' not in marks['marker name']
302-
303-
304-
def test_add_single_marker(): # in test_marking_operations
305-
"""
306-
Test a few things related to naming marker sets
307-
"""
308-
fake_ccd = _make_fake_ccd(with_wcs=True)
309-
npix_side = fake_ccd.shape[0]
310-
wcs = fake_ccd.wcs
311-
iw = ImageWidget(pixel_coords_offset=0)
312-
iw.load_nddata(fake_ccd)
313-
# Get me 100 positions please, not right at the edge
314-
marker_locs = np.random.randint(10,
315-
high=npix_side - 10,
316-
size=(100, 2))
317-
marks_world = wcs.all_pix2world(marker_locs, 0)
318-
marks_coords = SkyCoord(marks_world, unit='degree')
319-
mark_coord_table = Table(data=[marks_coords], names=['coord'])
320-
iw.add_markers(mark_coord_table[0], use_skycoord=True)

0 commit comments

Comments
 (0)