Commit 8edcaeb6 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update RecordCdsConfPaper to improve _process_conference_data

parent cbd1df45
......@@ -116,7 +116,12 @@ class RecordCdsConfPaper(RecordCdsPubli, ConfMixin):
logger.debug(f"{T6}conference data not found")
return
city, country = data.get("location", ",").split(",")
# extract city and country
location = data.get("location", ",")
if location.count(",") == 2:
city, state, country = location.split(",")
else:
city, country = location.split(",")
# extract conference URL
obj = recjson.get("url", {})
......
# -*- coding: utf-8 -*-
"""test_com
"""test_70_com
* collection of conference talks with issues
"""
import pytest
from harvest_tools.checkandfix import CheckAndFix, CheckException
from store_tools import load_record
from store_tools import CheckException, is_conference, load_record
@pytest.fixture(scope="module")
def svc():
return CheckAndFix()
def test_com_cds1550918(svc):
def test_com_cds1550918_70001():
"""
XML:
* Only first author defined
JSON:
* Fix by the JSON encoding
"""
reccds = load_record('cds.cern.ch', 1550918)
record = load_record('cds.cern.ch', 1550918)
assert reccds.authors() == "Le Gac, R"
assert reccds.first_author() == "Le Gac, R"
assert record.authors() == "Le Gac, R"
assert record.first_author() == "Le Gac, R"
def test_com_cds2241325(svc):
def test_com_cds2241325_70002():
"""
XML:
* First author not defined and equal to ATLAS Collaboration
......@@ -42,19 +36,18 @@ def test_com_cds2241325(svc):
* Reject by CheckAndFix.authors and CheckAndFix.is_conference
"""
reccds = load_record("cds.cern.ch", 2241325)
record = load_record("cds.cern.ch", 2241325)
assert reccds.authors() == "ATLAS Collaboration"
assert not reccds.is_affiliations()
assert record.authors() == "ATLAS Collaboration"
assert not record.is_affiliations()
with pytest.raises(CheckException):
svc.is_conference(reccds)
assert is_conference(record) is False
with pytest.raises(CheckException):
svc.authors(reccds)
record.check_authors()
def test_com_cds2260981(svc):
def test_com_cds2260981_70003():
"""
XML:
* First author not defined and equal to ATLAS Collaboration
......@@ -67,16 +60,16 @@ def test_com_cds2260981(svc):
* Reject by CheckAndFix.authors
"""
reccds = load_record("cds.cern.ch", 2260981)
record = load_record("cds.cern.ch", 2260981)
assert reccds.first_author() == "ATLAS Collaboration"
assert reccds.authors() == "ATLAS Collaboration, Spalla, Margherita"
assert record.first_author() == "ATLAS Collaboration"
assert record.authors() == "ATLAS Collaboration, Spalla, Margherita"
assert not reccds.is_affiliation_for_all()
assert not record.is_affiliation_for_all()
assert svc.is_conference(reccds) is None
assert reccds.conference_dates() == "17 - 22 Apr 2017"
assert reccds.conference_location() == "Obergurgl, Austria"
assert is_conference(record)
assert record.conference_dates() == "17-22 Apr 2017"
assert record.conference_location() == "Obergurgl, Austria"
with pytest.raises(CheckException):
svc.authors(reccds)
record.check_authors()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment