test_acti_cds1411352_fix.py 2.13 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
# -*- coding: utf-8 -*-
"""PROCEEDING

    http://cds.cern.ch/record/1411352

    Prospects for CP violation in B0s --> J/psiphi from first LHCb data
    O. Leroy, Symposium on Prospects in the Physics of Discrete Symmetries,
    Rome, Italy, 6 - 11 Dec 2010
    J. Phys.: Conf. Ser. 335 (2011) 012042

No correction are applied to the record.
Allow to test the brute force decoding with its mistakes.

Note:
    * Only the first authors is defined
    * The submitted date is 05 Jan 2012
17
    * conference date 6 - 11 Dec 2010
18 19

"""
20
import copy
21 22
import pytest

23 24
from harvest_tools import CheckAndFix, family_name_fr, format_author_fr
from invenio_tools import load_record
25 26 27 28 29 30 31 32


@pytest.fixture(scope="module")
def record():
    rec = load_record('cds.cern.ch', 1411352)
    return rec


33 34 35 36
@pytest.fixture(scope="module")
def recordfix(record):
    rec = copy.deepcopy(record)

37
    svc = CheckAndFix()
38
    svc.authors(rec)
39
    svc.country(rec)
LE GAC Renaud's avatar
LE GAC Renaud committed
40
    svc.conference_date(rec, "cds.cern.ch")
41 42
    svc.format_authors(rec, format_author_fr)
    svc.format_editor(rec)
43
    svc.get_my_authors(rec, family_name_fr)
44 45 46 47 48 49 50
    svc.submitted(rec)
    svc.year(rec)

    return rec


def test_authors(record, recordfix):
51
    assert record.authors() == "Leroy, Olivier"
52
    assert recordfix.authors() == "O. Leroy"
53 54


55 56 57
def test_conference_dates(record, recordfix):
    assert record.conference_dates() == "6 - 11 Dec 2010"
    assert recordfix.conference_dates() == "6-11 Dec 2010"
58 59


60
def test_first_author(record, recordfix):
61
    assert record.first_author() == "Leroy, Olivier"
62
    assert recordfix.first_author() == "O. Leroy"
63 64


65
def test_first_institutes(record, recordfix):
66
    assert record.first_author_institutes() == "Marseille, CPPM"
67
    assert recordfix.first_author_institutes() == "Marseille, CPPM"
68 69


70
def test_institutes(record, recordfix):
71 72
    assert record.institutes() == ['Marseille, CPPM']
    assert record.is_affiliation_for_all() == True
73

74
    assert recordfix.institutes() == ["Marseille, CPPM"]
75
    assert recordfix.is_affiliation_for_all() == True
76

77

78
def test_submitted(record, recordfix):
79
    assert record.submitted() == ["05 Jan 2012"]
80
    assert recordfix.submitted() == ["2012-01-05"]