hep: don't normalize again names in references
Closed this issue · 4 comments
jacquerie commented
See:
inspire-dojson/tests/test_hep_bd9xx.py
Lines 808 to 864 in d1524e2
@pytest.mark.xfail(reason="normalized names don't stay normalized") | |
def test_references_from_999C59_h_m_o_double_r_y(): | |
schema = load_schema('hep') | |
subschema = schema['properties']['references'] | |
snippet = ( | |
'<datafield tag="999" ind1="C" ind2="5">' | |
' <subfield code="9">CURATOR</subfield>' | |
' <subfield code="h">Bennett, J</subfield>' | |
' <subfield code="m">Roger J. et al.</subfield>' | |
' <subfield code="o">9</subfield>' | |
' <subfield code="r">CERN-INTC-2004-016</subfield>' | |
' <subfield code="r">CERN-INTCP-186</subfield>' | |
' <subfield code="y">2004</subfield>' | |
'</datafield>' | |
) # record/1449990 | |
expected = [ | |
{ | |
'reference': { | |
'authors': [ | |
{'full_name': 'Bennett, J'}, | |
], | |
'label': '9', | |
'misc': [ | |
'Roger J. et al.', | |
], | |
'publication_info': {'year': 2004}, | |
'report_numbers': [ | |
'CERN-INTC-2004-016', | |
'CERN-INTCP-186', | |
], | |
}, | |
}, | |
] | |
result = hep.do(create_record(snippet)) | |
assert validate(result['references'], subschema) is None | |
assert expected == result['references'] | |
expected = [ | |
{ | |
'h': [ | |
'Bennett, J', | |
], | |
'r': [ | |
'CERN-INTCP-186', | |
'CERN-INTC-2004-016', | |
], | |
'm': 'Roger J. et al.', | |
'o': '9', | |
'y': 2004, | |
}, | |
] | |
result = hep2marc.do(result) | |
assert expected == result['999C5'] |
michamos commented
this should be fixed in the reference builer, by using normalize_name
.
ammirate commented
Where is defined normalize_name
?
michamos commented
normalize_name
in inspire_schemas.utils
find you shall.
ammirate commented
normalize_author_name
🥇