|
3 | 3 | from ...utils.testing_tools import MockResponse |
4 | 4 | from astropy import units as u |
5 | 5 | from astropy.tests.helper import pytest, remote_data |
| 6 | +from astropy.extern.six.moves import urllib_parse |
6 | 7 | import requests |
7 | 8 | import os |
8 | 9 |
|
@@ -112,7 +113,33 @@ def test_band_crashorno(): |
112 | 113 | @remote_data |
113 | 114 | def test_version_selection(): |
114 | 115 | results = splatalogue.Splatalogue.query_lines( |
115 | | - min_frequency=703 * u.GHz, max_frequency=706 * u.GHz, |
116 | | - chemical_name='Acetaldehyde', version='v1.0') |
117 | | - |
118 | | - assert len(results) == 133 |
| 116 | + min_frequency= 703*u.GHz, |
| 117 | + max_frequency=706*u.GHz, |
| 118 | + chemical_name='Acetaldehyde', |
| 119 | + version='v1.0' |
| 120 | + ) |
| 121 | + assert len(results)==1 |
| 122 | + |
| 123 | +def test_exclude(patch_post): |
| 124 | + # regression test for issue 616 |
| 125 | + d = splatalogue.Splatalogue.query_lines_async(114 * u.GHz, 116 * u.GHz, |
| 126 | + chemical_name=' CO ', |
| 127 | + get_query_payload=True) |
| 128 | + |
| 129 | + exclusions = {'no_atmospheric': 'no_atmospheric', |
| 130 | + 'no_potential': 'no_potential', |
| 131 | + 'no_probable': 'no_probable',} |
| 132 | + |
| 133 | + for k,v in exclusions.items(): |
| 134 | + assert d[k] == v |
| 135 | + |
| 136 | + d = splatalogue.Splatalogue.query_lines_async(114 * u.GHz, 116 * u.GHz, |
| 137 | + chemical_name=' CO ', |
| 138 | + exclude='none', |
| 139 | + get_query_payload=True) |
| 140 | + |
| 141 | + for k,v in exclusions.items(): |
| 142 | + assert k not in d |
| 143 | + |
| 144 | + for k in d: |
| 145 | + assert k[:3] != 'no_' |
0 commit comments