|
2 | 2 | """
|
3 | 3 | test_mpc
|
4 | 4 |
|
5 |
| -Generate offline ephemeris files for testing with the following |
6 |
| -commands. The asteroid must be one that returns ephemeris |
7 |
| -uncertainties: |
| 5 | +Generate offline ephemeris files for testing with the following commands. |
| 6 | +
|
| 7 | + * The first object can be any target with successful queries. |
| 8 | +
|
| 9 | + * The second object must be one that returns ephemeris uncertainties. |
| 10 | +
|
| 11 | + * The third object must be one that does not exist in the MPC database. The |
| 12 | + string 'test fail' is sufficient. |
| 13 | + |
| 14 | + * The fourth object must be one that fails an orbit lookup. Today (2022 |
| 15 | + July), that is 2008 JG, which has a permanent number 613986. The ephemeris |
| 16 | + service is not resolving the temporary designation to the permanent number, |
| 17 | + and therefore fails the orbit lookup. |
| 18 | +
|
| 19 | +Any changes to these queries (such as target name) must be reflected in the |
| 20 | +appropriate tests below. |
8 | 21 |
|
9 | 22 | ```
|
10 | 23 | from astroquery.mpc import MPC
|
|
17 | 30 | '2P_ephemeris_500-a-s': ('2P', {'proper_motion': 'sky'}),
|
18 | 31 | '1994XG_ephemeris_500-a-t': ('1994 XG', {}),
|
19 | 32 | '1994XG_ephemeris_G37-a-t': ('1994 XG', {'location': 'G37'}),
|
20 |
| - 'testfail_ephemeris_500-a-t': ('test fail', {}) |
| 33 | + 'testfail_ephemeris_500-a-t': ('test fail', {}), |
| 34 | + '2008JG_ephemeris_500-a-t': ('2008 JG', {}), |
21 | 35 | }
|
22 | 36 | for prefix, (name, kwargs) in parameters.items():
|
23 | 37 | with open(prefix + '.html', 'w') as outf:
|
|
39 | 53 | wget https://minorplanetcenter.net/iau/lists/ObsCodes.html
|
40 | 54 |
|
41 | 55 | Then edit and remove all but the first 10 lines of observatories.
|
42 |
| -This is sufficient for testing. |
| 56 | +This is sufficient for offline testing. |
43 | 57 |
|
44 | 58 | """
|
45 | 59 | import os
|
@@ -180,6 +194,11 @@ def test_get_ephemeris_by_name_fail(patch_post):
|
180 | 194 | mpc.core.MPC.get_ephemeris('test fail')
|
181 | 195 |
|
182 | 196 |
|
| 197 | +def test_get_ephemeris_object_without_orbit(patch_post): |
| 198 | + with pytest.raises(InvalidQueryError): |
| 199 | + mpc.core.MPC.get_ephemeris('2008 JG') |
| 200 | + |
| 201 | + |
183 | 202 | def test_get_ephemeris_location_str():
|
184 | 203 | payload = mpc.core.MPC.get_ephemeris(
|
185 | 204 | '(1)', location='000', get_query_payload=True)
|
|
0 commit comments