Skip to content

Commit 100f81f

Browse files
authored
Bugfix regression in test for distance attr (#197)
1 parent b3a3b22 commit 100f81f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

sunpy_soar/tests/test_sunpy_soar.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ def test_distance_out_of_bounds_warning(recwarn):
358358

359359

360360
@pytest.mark.skipif(SUNPY_VERSION < (7, 1), reason="Skip pre sunpy 7.1")
361-
def test_distance_out_of_bounds_warning_post71():
361+
def test_distance_out_of_bounds_warning_post71(recwarn):
362362
instrument = a.Instrument("EUI")
363363
time = a.Time("2023-04-27", "2023-04-28")
364364
level = a.Level(2)
@@ -367,7 +367,14 @@ def test_distance_out_of_bounds_warning_post71():
367367
# Run the search and ensure it raises an HTTPError
368368
query = Fido.search(distance & instrument & product & level & time)
369369
# Check if the warning was raised
370-
assert "Distance values must be within the range 0.28 AU to 1.0 AU." in str(query['soar'].errors)
370+
assert query['soar'].errors
371+
# Check if the warning was raised
372+
warnings_list = recwarn.list
373+
assert any(
374+
warning.message.args[0] == "Distance values must be within the range 0.28 AU to 1.0 AU."
375+
and issubclass(warning.category, SunpyUserWarning)
376+
for warning in warnings_list
377+
)
371378

372379

373380
# Remove this test and the mark from below once min sunpy dep >=7.1

0 commit comments

Comments
 (0)