Skip to content

Commit

Permalink
Merge d8f1306 into 4eb0d2c
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiaverga committed Oct 4, 2023
2 parents 4eb0d2c + d8f1306 commit ed927c4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions database/createdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
'Harvard': r'^(H\s?)(\d{1,2})$',
'Hickson': r'^(HCG\s?)(\d{1,3})$',
'LBN': r'^(LBN\s?)(\d{1,3})$',
'MCG': r'^(MCG\s?)([+-]\d{2}-\d{2}-\d{3,4})$',
'Melotte': r'^(MEL\s?)(\d{1,3})$',
'MWSC': r'^(MWSC\s?)(\d{1,4})$',
'PGC': r'^((?:PGC|LEDA)\s?)(\d{1,6})$',
Expand Down Expand Up @@ -191,6 +192,9 @@
elif cat == 'PGC':
# Fixed catalog name to recognize also LEDA prefix
objectname = f'{cat}{name_parts.group(2):0>6}'
elif cat == 'MCG':
objectname = f'{name_parts.group(1).strip()}' \
f'{name_parts.group(2).strip()}'
else:
objectname = f'{name_parts.group(1).strip()}' \
f'{name_parts.group(2):0>3}'
Expand Down
Binary file modified src/pyongc/ongc.db
Binary file not shown.
1 change: 1 addition & 0 deletions src/pyongc/ongc.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
'Harvard': r'^(H\s?)(\d{1,2})$',
'Hickson': r'^(HCG\s?)(\d{1,3})$',
'LBN': r'^(LBN\s?)(\d{1,3})$',
'MCG': r'^(MCG\s?)([+-]\d{2}-\d{2}-\d{3,4})$',
'Melotte': r'^(MEL\s?)(\d{1,3})$',
'MWSC': r'^(MWSC\s?)(\d{1,4})$',
'PGC': r'^((?:PGC|LEDA)\s?)(\d{1,6})$',
Expand Down
9 changes: 9 additions & 0 deletions tests/test_ongc.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ def test_name_recognition_M102(self):
"""Test M102 == M101."""
assert ongc.Dso('M102').name == ongc.Dso('M101').name

def test_name_recognition_MCG(self):
"""Test the recognition of a MCG identifier."""
assert ongc.Dso('MCG-02-01-031').name == 'IC0002'
assert ongc.Dso('MCG+00-01-038').name == 'IC0003'

def test_name_recognition_MWSC(self):
"""Test the recognition of a MWSC identifier."""
assert ongc.Dso('MWSC146').name == 'IC0166'
Expand All @@ -99,6 +104,10 @@ def test_name_recognition_UGC(self):
"""Test the recognition of a UGC identifier."""
assert ongc.Dso('UGC9965').name == 'IC1132'

def test_name_recognition_UGCA(self):
"""Test the recognition of a UGCA identifier."""
assert ongc.Dso('UGCA99').name == 'IC0402'

def test_duplicate_resolving(self):
"""Test that a duplicated object is returned as himself when asked to do so."""
assert ongc.Dso('ngc20').name == 'NGC0006'
Expand Down

0 comments on commit ed927c4

Please sign in to comment.