Skip to content

Commit

Permalink
Merge pull request #25 from ammirate/bump_to_schema_48
Browse files Browse the repository at this point in the history
global: bump inspire-schemas to version ~48.0
  • Loading branch information
ammirate authored Sep 12, 2017
2 parents e4d98c4 + d6e1ebc commit 70552a8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
3 changes: 3 additions & 0 deletions inspire_json_merger/merger_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class ArxivToArxivOperations(MergerConfigurationOperations):
'references.reference.dois': UnifierOps.KEEP_ONLY_UPDATE_ENTITIES,
'references.reference.misc': UnifierOps.KEEP_ONLY_UPDATE_ENTITIES,
'references.reference.persistent_identifiers': UnifierOps.KEEP_ONLY_UPDATE_ENTITIES,
'references.reference.report_numbers': UnifierOps.KEEP_UPDATE_AND_HEAD_ENTITIES_HEAD_FIRST,
'references.reference.urls': UnifierOps.KEEP_ONLY_UPDATE_ENTITIES,
'report_numbers': UnifierOps.KEEP_ONLY_UPDATE_ENTITIES,
'special_collections': UnifierOps.KEEP_ONLY_HEAD_ENTITIES,
Expand Down Expand Up @@ -247,6 +248,7 @@ class PublisherToArxivOperations(MergerConfigurationOperations):
'references.reference.dois': UnifierOps.KEEP_ONLY_UPDATE_ENTITIES,
'references.reference.misc': UnifierOps.KEEP_ONLY_UPDATE_ENTITIES,
'references.reference.persistent_identifiers': UnifierOps.KEEP_ONLY_UPDATE_ENTITIES,
'references.reference.report_numbers': UnifierOps.KEEP_UPDATE_AND_HEAD_ENTITIES_HEAD_FIRST,
'references.reference.urls': UnifierOps.KEEP_ONLY_UPDATE_ENTITIES,
'report_numbers': UnifierOps.KEEP_UPDATE_ENTITIES_CONFLICT_ON_HEAD_DELETE,
'special_collections': UnifierOps.KEEP_ONLY_HEAD_ENTITIES,
Expand Down Expand Up @@ -372,6 +374,7 @@ class PublisherToPublisherOperations(MergerConfigurationOperations):
'references.reference.dois': UnifierOps.KEEP_ONLY_UPDATE_ENTITIES,
'references.reference.misc': UnifierOps.KEEP_ONLY_UPDATE_ENTITIES,
'references.reference.persistent_identifiers': UnifierOps.KEEP_ONLY_UPDATE_ENTITIES,
'references.reference.report_numbers': UnifierOps.KEEP_UPDATE_AND_HEAD_ENTITIES_HEAD_FIRST,
'references.reference.urls': UnifierOps.KEEP_ONLY_UPDATE_ENTITIES,
'report_numbers': UnifierOps.KEEP_ONLY_UPDATE_ENTITIES,
'special_collections': UnifierOps.KEEP_ONLY_HEAD_ENTITIES,
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@
'munkres>=1.0.7',
'Unidecode>=0.4.19',
'autosemver',

'inspire-schemas~=45.0,>=45.0.1',
'inspire-schemas~=48.0,>=48.0.0',
]

packages = find_packages()
Expand Down
26 changes: 20 additions & 6 deletions tests/unit/test_merger_arxiv2arxiv.py
Original file line number Diff line number Diff line change
Expand Up @@ -3434,15 +3434,15 @@ def test_merging_references_field_reference_persistent_identifiers():


@cover('references')
def test_merging_references_field_reference_report_number():
def test_merging_references_field_reference_report_numbers():
root = {
'references': [
{
'record': {
'$ref': 'http://newlabs.inspirehep.net/api/literature/619171'
},
'reference': {
'report_number': 'IFT-UAM-CSIC-14-035'
'report_numbers': ['IFT-UAM-CSIC-14-035']
}
}
]
Expand All @@ -3454,7 +3454,7 @@ def test_merging_references_field_reference_report_number():
'$ref': 'http://newlabs.inspirehep.net/api/literature/619171'
},
'reference': {
'report_number': 'IFT-UAM-CSIC-14-036'
'report_numbers': ['IFT-UAM-CSIC-14-036']
}
}
]
Expand All @@ -3466,14 +3466,28 @@ def test_merging_references_field_reference_report_number():
'$ref': 'http://newlabs.inspirehep.net/api/literature/619171'
},
'reference': {
'report_number': 'IFT-UAM-CSIC-14-037'
'report_numbers': ['IFT-UAM-CSIC-14-037']
}
}
]
}

expected_conflict = [['SET_FIELD', ['references', 0, 'reference', 'report_number'], 'IFT-UAM-CSIC-14-036']]
expected_merged = update
expected_conflict = None
expected_merged = {
'references': [
{
'record': {
'$ref': 'http://newlabs.inspirehep.net/api/literature/619171'
},
'reference': {
'report_numbers': [
'IFT-UAM-CSIC-14-036',
'IFT-UAM-CSIC-14-037',
]
}
}
]
}

root, head, update, expected_merged = add_arxiv_source(root, head, update, expected_merged)
merged, conflict = inspire_json_merge(root, head, update)
Expand Down

0 comments on commit 70552a8

Please sign in to comment.