# -*- 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 pytest from helper import load_record from gluon import current from harvest_tools import family_name_fr, format_author_fr from invenio_tools import CheckAndFix 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(): rec = load_record('cds.cern.ch', 1951625) # apply all corrections for an article svc = CheckAndFix() svc.authors(rec) svc.format_authors(rec, format_author_fr) svc.format_editor(rec) svc.my_authors(rec) svc.submitted(rec) svc.year(rec) return rec def test_authors(record): authors = record.authors_as_list() assert len(authors) == 704 assert authors[0] == "R. Aaij" assert authors[55] == "M.-O. Bettler" assert authors[344] == "R. Le Gac" assert authors[-1] == "A. Zvyagin" def test_find_authors_by_institute(record): rex = current.app.reg_institute assert rex == "CPPM" authors = record.find_authors_by_institute(rex, family_name_fr) authors = authors.split(", ") assert authors == CPPM_AUTHORS def test_first_author(record): assert record.first_author() == "R. Aaij" def test_my_authors(record): assert record.my_authors.split(', ') == CPPM_AUTHORS def test_paper_editor(record): assert record.paper_editor() == "J Instrum" def test_submitted(record): assert record.submitted() == ["2014-10-01"]