From f8b6580aac71949c9897d72b49bb906d05d545b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Mon, 8 Jan 2024 10:08:34 -0800 Subject: [PATCH 1/2] TST: cleanup tests --- astroquery/nist/tests/test_nist_remote.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/astroquery/nist/tests/test_nist_remote.py b/astroquery/nist/tests/test_nist_remote.py index 34beccf677..82b20c3603 100644 --- a/astroquery/nist/tests/test_nist_remote.py +++ b/astroquery/nist/tests/test_nist_remote.py @@ -5,18 +5,19 @@ import pytest -from ... import nist +from astroquery.nist import Nist @pytest.mark.remote_data class TestNist: def test_query_async(self): - response = nist.core.Nist.query_async(4000 * u.AA, 7000 * u.AA) + response = Nist.query_async(4000 * u.AA, 7000 * u.AA) assert response is not None + assert response.status_code == 200 def test_query(self): - result = nist.core.Nist.query(4000 * u.AA, 7000 * u.AA) + result = Nist.query(4000 * u.AA, 7000 * u.AA) assert isinstance(result, Table) # check that no javascript was left in the table @@ -24,29 +25,29 @@ def test_query(self): assert set(result['TP']) == set(['T8637', 'T7771']) def test_unescape_html(self): - response = nist.core.Nist.query_async(4333 * u.AA, 4334 * u.AA, linename="V I") + response = Nist.query_async(4333 * u.AA, 4334 * u.AA, linename="V I") assert '†' in response.text # check that Unicode characters have been properly unescaped from their # raw HTML code equivalents during parsing - response = nist.core.Nist._parse_result(response) + response = Nist._parse_result(response) assert any('†' in s for s in response['Ei Ek']) def test_query_limits(self): - result = nist.core.Nist.query(4101 * u.AA, 4103 * u.AA) + result = Nist.query(4101 * u.AA, 4103 * u.AA) # check that min, max wavelengths are appropriately set assert result['Ritz'].min() >= 4101 assert result['Ritz'].max() <= 4103 # check that the units are respected - result = nist.core.Nist.query(410.1 * u.nm, 410.3 * u.nm) + result = Nist.query(410.1 * u.nm, 410.3 * u.nm) assert result['Ritz'].min() >= 410.1 assert result['Ritz'].max() <= 410.3 - result = nist.core.Nist.query(0.4101 * u.um, 0.4103 * u.um) + result = Nist.query(0.4101 * u.um, 0.4103 * u.um) assert result['Ritz'].min() >= 0.4101 assert result['Ritz'].max() <= 0.4103 # check that non-supported units default to angstroms - result = nist.core.Nist.query(4101 * 1e-10 * u.m, 4103 * 1e-10 * u.m) + result = Nist.query(4101 * 1e-10 * u.m, 4103 * 1e-10 * u.m) assert result['Ritz'].min() >= 4101 assert result['Ritz'].max() <= 4103 From ae50f61563dc9167c19fc7d0776ce90bf4643c9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Mon, 8 Jan 2024 10:09:32 -0800 Subject: [PATCH 2/2] TST: fix handling of MaskedColumn/MaskedConstant --- astroquery/nist/tests/test_nist_remote.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/astroquery/nist/tests/test_nist_remote.py b/astroquery/nist/tests/test_nist_remote.py index 82b20c3603..6061574728 100644 --- a/astroquery/nist/tests/test_nist_remote.py +++ b/astroquery/nist/tests/test_nist_remote.py @@ -22,7 +22,8 @@ def test_query(self): # check that no javascript was left in the table # (regression test for 1355) - assert set(result['TP']) == set(['T8637', 'T7771']) + + assert set(result['TP'].filled()) == set(['T8637', 'T7771', 'N/A']) def test_unescape_html(self): response = Nist.query_async(4333 * u.AA, 4334 * u.AA, linename="V I")