test_record_non_conformities.py 1.43 KB
Newer Older
1
# -*- coding: utf-8 -*-
2
"""Record non conformities
3 4 5 6 7

From time to time some record keys are duplicated.
Protection are add in the record method to correct them

"""
8
from invenio_tools import load_record
9 10


11 12 13 14
def test_protection_authors_as_list():
    """[u'Zuniga, J.', u'(the A.N.T.ARES. Collaboration)']"""
    record = load_record('inspirehep.net', 1386663)
    authors = record.authors_as_list()
15 16
    assert len(authors) == 140
    assert authors[129] == u"Zuniga, J."
17 18


LE GAC Renaud's avatar
LE GAC Renaud committed
19 20
def test_protection_oai():
    """['oai:cds.cern.ch:1513204', 'oai:cds.cern.ch:1512766']"""
21
    record = load_record('cds.cern.ch', 1513204)
LE GAC Renaud's avatar
LE GAC Renaud committed
22
    assert record.oai() == 'oai:cds.cern.ch:1513204'
23 24 25
    assert record.host() == "cds.cern.ch"


26 27 28 29 30 31 32 33 34
def test_protection_paper_year():
    record = load_record('cds.cern.ch', 1951625)
    assert record["773"]["y"] == ["2014", "2014"]
    assert record.paper_year() == "2014"


def test_protection_paper_url():
    record = load_record('cds.cern.ch', 2014733)
    assert record.paper_url() == "http://arxiv.org/pdf/1505.01654"
35 36 37 38 39 40


def test_protection_year():
    record = load_record('inspirehep.net', 1319638)
    assert record["260"]["c"] == "2014-12-05"
    assert record.year() == "2014"
41 42


43
def test_protection_repord_number():
44 45
    record = load_record('inspirehep.net', 1221481)
    assert record.report_number() == ""
46 47 48 49

    record = load_record('cds.cern.ch', 1955425)
    assert record.report_number() == "ATLAS-EXOT-2014-01-003, CERN-PH-EP-2014-229"