|
@@ 202-213 (lines=12) @@
|
| 199 |
|
np.testing.assert_allclose(self.lat, [58.2258, 59.3186], rtol=1e-4) |
| 200 |
|
np.testing.assert_allclose(self.lon, [81.1685, 81.6140], rtol=1e-4) |
| 201 |
|
|
| 202 |
|
def test_convert_arr_mix(self): |
| 203 |
|
"""Test conversion for an array and floats""" |
| 204 |
|
with warnings.catch_warnings(): |
| 205 |
|
warnings.simplefilter("ignore") |
| 206 |
|
self.lat, self.lon = aacgmv2.convert(np.array([60, 61]), 0, 300, |
| 207 |
|
self.dtime) |
| 208 |
|
|
| 209 |
|
assert isinstance(self.lat, list) |
| 210 |
|
assert isinstance(self.lon, list) |
| 211 |
|
assert len(self.lat) == len(self.lon) and len(self.lat) == 2 |
| 212 |
|
np.testing.assert_allclose(self.lat, [58.2258, 59.3186], rtol=1e-4) |
| 213 |
|
np.testing.assert_allclose(self.lon, [81.1685, 81.6140], rtol=1e-4) |
| 214 |
|
|
| 215 |
|
def test_convert_mult_array_failure(self): |
| 216 |
|
"""Test conversion for a multi-dim array and floats""" |
|
@@ 189-200 (lines=12) @@
|
| 186 |
|
np.testing.assert_allclose(self.lat, [58.2258, 59.3186], rtol=1e-4) |
| 187 |
|
np.testing.assert_allclose(self.lon, [81.1685, 81.6140], rtol=1e-4) |
| 188 |
|
|
| 189 |
|
def test_convert_list_mix(self): |
| 190 |
|
"""Test conversion for a list and floats""" |
| 191 |
|
|
| 192 |
|
with warnings.catch_warnings(): |
| 193 |
|
warnings.simplefilter("ignore") |
| 194 |
|
self.lat, self.lon = aacgmv2.convert([60, 61], 0, 300, self.dtime) |
| 195 |
|
|
| 196 |
|
assert isinstance(self.lat, list) |
| 197 |
|
assert isinstance(self.lon, list) |
| 198 |
|
assert len(self.lat) == len(self.lon) and len(self.lat) == 2 |
| 199 |
|
np.testing.assert_allclose(self.lat, [58.2258, 59.3186], rtol=1e-4) |
| 200 |
|
np.testing.assert_allclose(self.lon, [81.1685, 81.6140], rtol=1e-4) |
| 201 |
|
|
| 202 |
|
def test_convert_arr_mix(self): |
| 203 |
|
"""Test conversion for an array and floats""" |
|
@@ 125-135 (lines=11) @@
|
| 122 |
|
"""Runs after every method to clean up previous testing""" |
| 123 |
|
del self.dtime, self.ddate, self.lat, self.lon |
| 124 |
|
|
| 125 |
|
def test_convert_single_val(self): |
| 126 |
|
"""Test conversion for a single value""" |
| 127 |
|
with warnings.catch_warnings(): |
| 128 |
|
warnings.simplefilter("ignore") |
| 129 |
|
self.lat, self.lon = aacgmv2.convert(60, 0, 300, self.dtime) |
| 130 |
|
|
| 131 |
|
assert isinstance(self.lat, list) |
| 132 |
|
assert isinstance(self.lon, list) |
| 133 |
|
assert len(self.lat) == len(self.lon) and len(self.lat) == 1 |
| 134 |
|
np.testing.assert_allclose(self.lat, [58.2258], rtol=1e-4) |
| 135 |
|
np.testing.assert_allclose(self.lon, [81.1685], rtol=1e-4) |
| 136 |
|
|
| 137 |
|
def test_convert_list(self): |
| 138 |
|
"""Test conversion for list input""" |