Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nabobalis committed Nov 11, 2024
1 parent 027967d commit fb303d8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ filterwarnings =
# https://github.com/pytest-dev/pytest-cov/issues/557
ignore:The --rsyncdir command line argument and rsyncdirs config variable are deprecated.:DeprecationWarning
ignore:File may have been truncated.*
ignore:pattern has been replaced with the format keyword
4 changes: 2 additions & 2 deletions radiospectra/net/sources/ilofar.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ def search(self, *args, **kwargs):
mask = np.full(len(query_response), True)
pol = matchdict.get("PolType")
if len(pol) == 1:
pol = pol.upper()
mask = mask & query_response["Polarisation"] == pol
pol = pol[0].upper()
mask = mask & (query_response["Polarisation"] == pol)

if query_response:
query_response.remove_column("PolType")
Expand Down
13 changes: 5 additions & 8 deletions radiospectra/net/sources/tests/test_ilofar.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,11 @@ def test_ilofar_client_polarisation(mock_urlopen, client, html_responses):
mock_urlopen.close = mock.MagicMock(return_value=None)
atr = a.Time("2018/06/01", "2018/06/02")
query_x = client.search(atr, PolType("X"))
query_y = client.search(atr, PolType("Y"))

for query, pol in zip([query_x, query_y], ["X", "Y"]):
assert len(query) == 4
assert query[0]["Source"] == "ILOFAR"
assert query[0]["Provider"] == "ILOFAR"
assert query[0]["Start Time"].iso == "2018-06-01 10:00:41.000"
assert query[0]["Polarisation"] == pol
assert len(query_x) == 4
assert query_x[0]["Source"] == "ILOFAR"
assert query_x[0]["Provider"] == "ILOFAR"
assert query_x[0]["Start Time"].iso == "2018-06-01 10:00:41.000"
assert query_x[0]["Polarisation"] =='X'


@mock.patch("sunpy.net.scraper.urlopen")
Expand Down

0 comments on commit fb303d8

Please sign in to comment.