def test_arxiv_derive_inspire_categories(): schema = load_schema('hep') arxiv_eprints_schema = schema['properties']['arxiv_eprints'] inspire_categories_schema = schema['properties']['inspire_categories'] data = { 'arxiv_eprints': [ { 'categories': [ 'nucl-th', ], 'value': '1605.03898', }, ], } # literature/1458300 extra_data = {} assert validate(data['arxiv_eprints'], arxiv_eprints_schema) is None obj = MockObj(data, extra_data) eng = MockEng() assert arxiv_derive_inspire_categories(obj, eng) is None expected = [ { 'source': 'arxiv', 'term': 'Theory-Nucl', }, ] result = obj.data['inspire_categories'] assert validate(result, inspire_categories_schema) is None assert expected == result
def test_arxiv_derive_inspire_categories(): schema = load_schema('hep') arxiv_eprints_schema = schema['properties']['arxiv_eprints'] inspire_categories_schema = schema['properties']['inspire_categories'] data = { 'arxiv_eprints': [ { 'categories': [ 'nucl-th', ], 'value': '1605.03898', }, ], } # literature/1458300 extra_data = {} assert validate(data['arxiv_eprints'], arxiv_eprints_schema) is None obj = MockObj(data, extra_data) eng = MockEng() assert arxiv_derive_inspire_categories(obj, eng) is None expected = [ { 'source': 'arxiv', 'term': 'Theory-Nucl', }, ] result = obj.data['inspire_categories'] assert validate(result, inspire_categories_schema) is None assert expected == result