Skip to content

Commit

Permalink
add and update remote tests
Browse files Browse the repository at this point in the history
  • Loading branch information
keflavich committed Jan 7, 2024
1 parent ecb4210 commit 0d79abd
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions astroquery/nist/tests/test_nist_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 0d79abd

Please sign in to comment.