|
@@ 223-234 (lines=12) @@
|
| 220 |
|
np.testing.assert_allclose(self.lat, [58.2258, 59.3186], rtol=1e-4) |
| 221 |
|
np.testing.assert_allclose(self.lon, [81.1685, 81.6140], rtol=1e-4) |
| 222 |
|
|
| 223 |
|
def test_convert_arr_mix(self): |
| 224 |
|
"""Test conversion for an array and floats""" |
| 225 |
|
with warnings.catch_warnings(): |
| 226 |
|
warnings.simplefilter("ignore") |
| 227 |
|
self.lat, self.lon = aacgmv2.convert(np.array([60, 61]), 0, 300, |
| 228 |
|
self.dtime) |
| 229 |
|
|
| 230 |
|
assert isinstance(self.lat, list) |
| 231 |
|
assert isinstance(self.lon, list) |
| 232 |
|
assert len(self.lat) == len(self.lon) and len(self.lat) == 2 |
| 233 |
|
np.testing.assert_allclose(self.lat, [58.2258, 59.3186], rtol=1e-4) |
| 234 |
|
np.testing.assert_allclose(self.lon, [81.1685, 81.6140], rtol=1e-4) |
| 235 |
|
|
| 236 |
|
def test_convert_mult_array_failure(self): |
| 237 |
|
"""Test conversion for a multi-dim array and floats""" |
|
@@ 210-221 (lines=12) @@
|
| 207 |
|
np.testing.assert_allclose(self.lat, [58.2258, 59.3186], rtol=1e-4) |
| 208 |
|
np.testing.assert_allclose(self.lon, [81.1685, 81.6140], rtol=1e-4) |
| 209 |
|
|
| 210 |
|
def test_convert_list_mix(self): |
| 211 |
|
"""Test conversion for a list and floats""" |
| 212 |
|
|
| 213 |
|
with warnings.catch_warnings(): |
| 214 |
|
warnings.simplefilter("ignore") |
| 215 |
|
self.lat, self.lon = aacgmv2.convert([60, 61], 0, 300, self.dtime) |
| 216 |
|
|
| 217 |
|
assert isinstance(self.lat, list) |
| 218 |
|
assert isinstance(self.lon, list) |
| 219 |
|
assert len(self.lat) == len(self.lon) and len(self.lat) == 2 |
| 220 |
|
np.testing.assert_allclose(self.lat, [58.2258, 59.3186], rtol=1e-4) |
| 221 |
|
np.testing.assert_allclose(self.lon, [81.1685, 81.6140], rtol=1e-4) |
| 222 |
|
|
| 223 |
|
def test_convert_arr_mix(self): |
| 224 |
|
"""Test conversion for an array and floats""" |
|
@@ 146-156 (lines=11) @@
|
| 143 |
|
"""Runs after every method to clean up previous testing""" |
| 144 |
|
del self.dtime, self.ddate, self.lat, self.lon |
| 145 |
|
|
| 146 |
|
def test_convert_single_val(self): |
| 147 |
|
"""Test conversion for a single value""" |
| 148 |
|
with warnings.catch_warnings(): |
| 149 |
|
warnings.simplefilter("ignore") |
| 150 |
|
self.lat, self.lon = aacgmv2.convert(60, 0, 300, self.dtime) |
| 151 |
|
|
| 152 |
|
assert isinstance(self.lat, list) |
| 153 |
|
assert isinstance(self.lon, list) |
| 154 |
|
assert len(self.lat) == len(self.lon) and len(self.lat) == 1 |
| 155 |
|
np.testing.assert_allclose(self.lat, [58.2258], rtol=1e-4) |
| 156 |
|
np.testing.assert_allclose(self.lon, [81.1685], rtol=1e-4) |
| 157 |
|
|
| 158 |
|
def test_convert_list(self): |
| 159 |
|
"""Test conversion for list input""" |