test_com_cds1550918_fix.py 1.55 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# -*- coding: utf-8 -*-
"""TALK

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

    LHCb Upgrade
    R. Le Gac, Flavor Physics & CP Violation ,
    Buzios, Rio, Brazil, 19 - 24 May 2013

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

Note:
    * Only first author defined
"""
LE GAC Renaud's avatar
LE GAC Renaud committed
16
import copy
17 18
import pytest

19 20
from harvest_tools import CheckAndFix, format_author_fr
from invenio_tools import load_record
21 22 23 24


@pytest.fixture(scope="module")
def record():
LE GAC Renaud's avatar
LE GAC Renaud committed
25 26 27 28 29 30
    return load_record('cds.cern.ch', 1550918)


@pytest.fixture(scope="module")
def recordfix(record):
    rec = copy.deepcopy(record)
31 32

    svc = CheckAndFix()
LE GAC Renaud's avatar
LE GAC Renaud committed
33
    svc.authors(rec)
34 35
    svc.country(rec)
    svc.conference_date(rec)
LE GAC Renaud's avatar
LE GAC Renaud committed
36 37 38 39
    svc.format_authors(rec, format_author_fr)
    svc.format_editor(rec)
    svc.submitted(rec)
    svc.year(rec)
40 41 42 43

    return rec


LE GAC Renaud's avatar
LE GAC Renaud committed
44
def test_authors(record, recordfix):
45
    assert record.authors() == "Le Gac, R"
LE GAC Renaud's avatar
LE GAC Renaud committed
46
    assert recordfix.authors() == "R. Le Gac"
47 48


LE GAC Renaud's avatar
LE GAC Renaud committed
49 50 51
def test_conference_dates(record, recordfix):
    assert record.conference_dates() == "19 - 24 May 2013"
    assert recordfix.conference_dates() == "19-24 May 2013"
52 53


LE GAC Renaud's avatar
LE GAC Renaud committed
54
def test_conference_country(record, recordfix):
55
    assert record.conference_country() == "Brazil"
LE GAC Renaud's avatar
LE GAC Renaud committed
56
    assert recordfix.conference_country() == "Brazil"
57 58


LE GAC Renaud's avatar
LE GAC Renaud committed
59
def test_conference_year(record, recordfix):
60
    assert record.conference_year() == "2013"
LE GAC Renaud's avatar
LE GAC Renaud committed
61
    assert recordfix.conference_year() == "2013"
62 63


LE GAC Renaud's avatar
LE GAC Renaud committed
64
def test_first_author(record, recordfix):
65
    assert record.first_author() == "Le Gac, R"
LE GAC Renaud's avatar
LE GAC Renaud committed
66
    assert recordfix.first_author() == "R. Le Gac"