test_60_acti.py 2.05 KB
Newer Older
1 2 3 4 5 6 7 8
"""test_acti

    * collection of proceeding with issues

"""
import pytest

from harvest_tools.checkandfix import CheckAndFix
9
from store_tools import load_record
10 11 12 13 14 15 16


@pytest.fixture(scope="module")
def svc():
    return CheckAndFix()


LE GAC Renaud's avatar
LE GAC Renaud committed
17
def test_acti_cds1411352(svc):
18
    """
LE GAC Renaud's avatar
LE GAC Renaud committed
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
    XML:
        * Only the first authors is defined
        * The submitted date is wrong 05 Jan 2012
        * The conference date is nto well formatted 6 - 11 Dec 2010

    JSON:
        * Authors fix by the JSON encoding
        * Other issues are treated by CheckAndFix
    """
    reccds = load_record('cds.cern.ch', 1411352)

    assert reccds.authors() == "Leroy, Olivier"
    assert reccds.conference_dates() == "6 - 11 Dec 2010"
    assert reccds.submitted() == "05 Jan 2012"

    svc.conference_date(reccds)
    svc.submitted(reccds)

    assert reccds.conference_dates() == "6-11 Dec 2010"
    assert reccds.submitted() == "2012-01-05"


41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
def test_acti_cds2270937(svc):
    """
    JSON:
        * Author name not well formatted when using F. Last.
        * More general design of the function recordpubli.to_initial

    """
    reccds = load_record('cds.cern.ch', 2270937)
    assert reccds.first_author() == "De Bruyn, Kristof Antoon M"

    svc.format_authors(reccds, fmt="F. Last")

    assert reccds.first_author() == "K. A. M. De Bruyn"


LE GAC Renaud's avatar
LE GAC Renaud committed
56 57 58 59 60 61 62 63 64 65 66 67 68
def test_acti_ins1276938(svc):
    """
    XML:
        * Only first author is defined
        * Collaboration is not well formed ATLAS
        * First author affiliation is not defined
        * Submitted date is not defined
        * Year is not defined

    JSON:
        * authors issues are fixed by the JSON encoding
        * others issues are fixed by CheckAndFix

69
    """
LE GAC Renaud's avatar
LE GAC Renaud committed
70 71 72 73 74 75 76 77 78
    recins = load_record('inspirehep.net', 1276938)

    assert recins.authors() == "Hubaut, F."
    assert recins.first_author() == "Hubaut, F."
    assert recins.collaboration() == "ATLAS"
    assert recins.submitted() == ""

    svc.collaboration(recins)
    svc.submitted(recins)
79

LE GAC Renaud's avatar
LE GAC Renaud committed
80 81
    assert recins.collaboration() == "ATLAS Collaboration"
    assert recins.submitted() == "2013-03-02"