# -*- coding: utf-8 -*- """ARTICLE http://cds.cern.ch/record/1951625. Precision luminosity measurements at LHCb, J. Instrum. 9 (2014) P12005 arXiv:1410.0149 704 authors The CheckAndFix correction are applied. Only the changes are checked Note: * The first author is not in the author list * LHCb collaboration * The publication year is a list (duplicate 773y) * The submitted date is not formatted: 01 Oct 2014 """ import copy import pytest from gluon import current from harvest_tools import CheckAndFix, family_name_fr, format_author_fr from invenio_tools import load_record CPPM_AUTHORS = [u"S. Akar", u"E. Aslanides", u"J. Cogan", u"W. Kanso", u"R. Le Gac", u"O. Leroy", u"G. Mancinelli", u"A. Mordà", u"M. Perrin-Terrin", u"J. Serrano", u"A. Tsaregorodtsev"] @pytest.fixture(scope="module") def record(): return load_record('cds.cern.ch', 1951625) @pytest.fixture(scope="module") def recordfix(record): rec = copy.deepcopy(record) svc = CheckAndFix() svc.authors(rec) svc.format_authors(rec, format_author_fr) svc.format_editor(rec) svc.get_my_authors(rec, cmpFct=family_name_fr) svc.submitted(rec) svc.year(rec) return rec def test_find_authors_by_affiliation(recordfix): rex = current.app.reg_institute assert rex == "Marseille, CPPM|CPPM, Marseille" authors = recordfix.find_authors_by_affiliation(rex, family_name_fr) assert authors.split(', ') == CPPM_AUTHORS def test_first_author(record, recordfix): assert record.first_author() == "Aaij, Roel" assert recordfix.first_author() == "R. Aaij" def test_my_authors(recordfix): assert recordfix.my_authors.split(', ') == CPPM_AUTHORS def test_paper_editor(record, recordfix): assert record.paper_editor() == "J. Instrum." assert recordfix.paper_editor() == "J Instrum" def test_submitted(record, recordfix): assert record.submitted() == ["01 Oct 2014"] assert recordfix.submitted() == ["2014-10-01"]