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): ...@@ -116,7 +116,12 @@ class RecordCdsConfPaper(RecordCdsPubli, ConfMixin):
logger.debug(f"{T6}conference data not found") logger.debug(f"{T6}conference data not found")
return 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 # extract conference URL
obj = recjson.get("url", {}) obj = recjson.get("url", {})
......
# -*- coding: utf-8 -*- """test_70_com
"""test_com
* collection of conference talks with issues * collection of conference talks with issues
""" """
import pytest import pytest
from harvest_tools.checkandfix import CheckAndFix, CheckException from store_tools import CheckException, is_conference, load_record
from store_tools import load_record
@pytest.fixture(scope="module") def test_com_cds1550918_70001():
def svc():
return CheckAndFix()
def test_com_cds1550918(svc):
""" """
XML: XML:
* Only first author defined * Only first author defined
JSON: JSON:
* Fix by the JSON encoding * 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 record.authors() == "Le Gac, R"
assert reccds.first_author() == "Le Gac, R" assert record.first_author() == "Le Gac, R"
def test_com_cds2241325(svc): def test_com_cds2241325_70002():
""" """
XML: XML:
* First author not defined and equal to ATLAS Collaboration * First author not defined and equal to ATLAS Collaboration
...@@ -42,19 +36,18 @@ def test_com_cds2241325(svc): ...@@ -42,19 +36,18 @@ def test_com_cds2241325(svc):
* Reject by CheckAndFix.authors and CheckAndFix.is_conference * 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 record.authors() == "ATLAS Collaboration"
assert not reccds.is_affiliations() assert not record.is_affiliations()
with pytest.raises(CheckException): assert is_conference(record) is False
svc.is_conference(reccds)
with pytest.raises(CheckException): with pytest.raises(CheckException):
svc.authors(reccds) record.check_authors()
def test_com_cds2260981(svc): def test_com_cds2260981_70003():
""" """
XML: XML:
* First author not defined and equal to ATLAS Collaboration * First author not defined and equal to ATLAS Collaboration
...@@ -67,16 +60,16 @@ def test_com_cds2260981(svc): ...@@ -67,16 +60,16 @@ def test_com_cds2260981(svc):
* Reject by CheckAndFix.authors * 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 record.first_author() == "ATLAS Collaboration"
assert reccds.authors() == "ATLAS Collaboration, Spalla, Margherita" 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 is_conference(record)
assert reccds.conference_dates() == "17 - 22 Apr 2017" assert record.conference_dates() == "17-22 Apr 2017"
assert reccds.conference_location() == "Obergurgl, Austria" assert record.conference_location() == "Obergurgl, Austria"
with pytest.raises(CheckException): 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