sbpy
sbpy copied to clipboard
Invalid cometary designations with a fragment specifier are successfully packed.
High-level problem description
Invalid cometary designations with a fragment specifier are successfully packed.
What did you do?
In [3]: Names.to_packed("2024 A-A")
Out[3]: 'K24A00a'
Note that the invalid target "2024 A" fails as expected.
----> 1 Names.to_packed("2024 A")
File /disks/data0/astro/Projects/sbpy/sbpy/data/names.py:190, in Names.to_packed(s)
186 raise TargetNameParseError(
187 ('{} cannot be turned into a '
188 'packed number or designation').format(s))
189 except (IndexError, ValueError):
--> 190 raise TargetNameParseError(
191 ('{} cannot be turned into a '
192 'packed number or designation').format(s))
193 else:
194 raise TargetNameParseError(
195 ('{} cannot be turned into a '
196 'packed number or designation').format(s))
TargetNameParseError: 2024 A cannot be turned into a packed number or designation
What did you expect?
A TargetNameParseError exception.
Proposed solution
Trim the fragment specifier off the designation, parse the string with the usual rules, then account for the fragment.