def test_arxiv_id(): schema = load_schema('hep') subschema = schema['properties']['arxiv_eprints'] record = { 'arxiv_eprints': [ { 'categories': [ 'hep-th', 'hep-ph', ], 'value': '1612.08928', }, ], } assert validate(record['arxiv_eprints'], subschema) is None expected = '1612.08928' result = LiteratureReader(record).arxiv_id assert expected == result
def test_is_published(): schema = load_schema('hep') dois_schema = schema['properties']['dois'] publication_info_schema = schema['properties']['publication_info'] record = { 'dois': [ { 'value': '10.1016/0029-5582(61)90469-2' }, ], 'publication_info': [ { 'journal_title': 'Nucl.Phys.' }, ], } assert validate(record['dois'], dois_schema) is None assert validate(record['publication_info'], publication_info_schema) is None assert LiteratureReader(record).is_published
def test_inspire_categories(): schema = load_schema('hep') subschema = schema['properties']['inspire_categories'] record = { 'inspire_categories': [ { 'term': 'Experiment-HEP' }, { 'term': 'Quantum Physics' }, { 'term': 'Condensed Matter' }, ], } assert validate(record['inspire_categories'], subschema) is None expected = ['Experiment-HEP', 'Quantum Physics', 'Condensed Matter'] result = LiteratureReader(record).inspire_categories assert expected == result
def doi(self): """Get DOI of a record.""" return LiteratureReader(self.record).doi
def journal_title(self): """Get record's journal title.""" return LiteratureReader(self.record).journal_title