File tree Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,17 @@ sbpy.names
41
41
cometary designations with fragment specifiers (e.g., "2024 A-A" and
42
42
"2024 A-AA" now correctly raise TargetNameParseError exceptions) [#417]
43
43
44
+ - Fixed `sbpy.Names.parse_comet()' to raise an error in cases of a
45
+ provisional asteroid designation submitted with no space after the
46
+ year (e.g., "2015XN77"), which was previously being interpreted as a
47
+ well-formed comet designation (i.e., with number=2015, type=X, and
48
+ name=N77), but now raises a TargetNameParseError [#422]
49
+
50
+ - Fixed `sbpy.Names.parse_asteroid()' to raise an error in cases of a
51
+ provisional comet designation submitted with no forward slash between
52
+ the lead character and the year, and no space after the year (e.g.,
53
+ "P2015XN77"), which was previously being interpreted as a packed
54
+ asteroid designation, but now raises a TargetNameParseError [#422]
44
55
45
56
0.5.0 (2024-08-28)
46
57
==================
Original file line number Diff line number Diff line change @@ -436,6 +436,9 @@ def parse_comet(s):
436
436
if len (el [5 ]) > 0 :
437
437
if len (el [5 ]) > 1 :
438
438
r ['name' ] = el [5 ]
439
+ if r ['name' ][1 ].isdigit ():
440
+ raise TargetNameParseError ('{} does not appear to be a '
441
+ ' comet identifier' .format (s ))
439
442
440
443
if len (r ) == 0 or 'type' not in r :
441
444
raise TargetNameParseError (('{} does not appear to be a '
@@ -585,7 +588,7 @@ def parse_asteroid(s):
585
588
ident = el [4 ]
586
589
r ['desig' ] = Names .from_packed (ident )
587
590
# packed number
588
- elif len (el [5 ]) > 0 :
591
+ elif len (el [5 ]) > 0 and len ( el [ 5 ]) == len ( raw ) :
589
592
ident = el [5 ]
590
593
r ['number' ] = Names .from_packed (ident )
591
594
# number
Original file line number Diff line number Diff line change @@ -244,6 +244,9 @@ def test_parse_comet():
244
244
with pytest .raises (TargetNameParseError ):
245
245
Names .parse_comet ('2024 A' )
246
246
247
+ with pytest .raises (TargetNameParseError ):
248
+ Names .parse_comet ('2015XN77' )
249
+
247
250
248
251
def test_parse_asteroid ():
249
252
"""Test asteroid name parsing."""
@@ -271,6 +274,9 @@ def test_parse_asteroid():
271
274
with pytest .raises (TargetNameParseError ):
272
275
Names .parse_asteroid ('J1' )
273
276
277
+ with pytest .raises (TargetNameParseError ):
278
+ Names .parse_asteroid ('P2015XN77' )
279
+
274
280
275
281
def test_break_packed ():
276
282
with pytest .raises (TargetNameParseError ):
You can’t perform that action at this time.
0 commit comments