# -*- coding: utf-8 -*- """PROCEEDING http://inspirehep.net/record/1276938 ATLAS studies on Higgs to diboson states F Hubaut for the Atlas collaboration 48th Rencontres de Moriond on Electroweak Interactions and Unified Theories La Thuile, Italy, 2-9 Mar 2013 No corrections are applied to the record. Allow to test the brute force decoding with its mistakes. Note: * 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 """ import copy import pytest from harvest_tools import (CheckAndFix, CheckException, format_author_fr, ToolException) from invenio_tools import load_record @pytest.fixture(scope="module") def record(): rec = load_record('inspirehep.net', 1276938) return rec @pytest.fixture(scope="module") def recordfix(record): rec = copy.deepcopy(record) svc = CheckAndFix() svc.authors(rec) svc.country(rec) svc.conference_date(rec) svc.format_authors(rec, format_author_fr) svc.format_editor(rec) svc.submitted(rec) svc.year(rec) return rec def test_authors(record, recordfix): assert record.authors() == "Hubaut, F." assert recordfix.authors() == "F. Hubaut" def test_collaboration_exception(recordfix): svc = CheckAndFix() with pytest.raises(ToolException): svc.collaboration(recordfix) def test_my_authors_exception(recordfix): svc = CheckAndFix() with pytest.raises(CheckException): svc.get_my_authors(recordfix) def test_submitted(record, recordfix): assert record.submitted() == [] assert recordfix.submitted() == ["2013-03-02"] def test_year(record, recordfix): assert record.year() == "" assert recordfix.year() == "2013"