From 0d79abdeebc687b3809f1a99d415ef8cca92943f Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Sun, 7 Jan 2024 14:01:00 -0500 Subject: [PATCH] add and update remote tests --- astroquery/nist/tests/test_nist_remote.py | 24 +++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/astroquery/nist/tests/test_nist_remote.py b/astroquery/nist/tests/test_nist_remote.py index b7dc7e2b44..34beccf677 100644 --- a/astroquery/nist/tests/test_nist_remote.py +++ b/astroquery/nist/tests/test_nist_remote.py @@ -12,11 +12,11 @@ class TestNist: def test_query_async(self): - response = nist.core.Nist.query_async(4000 * u.nm, 7000 * u.nm) + response = nist.core.Nist.query_async(4000 * u.AA, 7000 * u.AA) assert response is not None def test_query(self): - result = nist.core.Nist.query(4000 * u.nm, 7000 * u.nm) + result = nist.core.Nist.query(4000 * u.AA, 7000 * u.AA) assert isinstance(result, Table) # check that no javascript was left in the table @@ -30,3 +30,23 @@ def test_unescape_html(self): # raw HTML code equivalents during parsing response = nist.core.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) + # 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) + 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) + 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) + assert result['Ritz'].min() >= 4101 + assert result['Ritz'].max() <= 4103