Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 123eed1b authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update RecordPubli to add protection in _process_authors.

parent a79e38ca
......@@ -154,8 +154,14 @@ class RecordPubli(Record):
df = df.drop(columns.difference(["a", "e", "u"]), axis="columns")
# add columns first_name, last_name and fmt_name
# warning: in some case split create more than 2 columns
df[columns4names] = df.a.str.split(u",", expand=True)[[0, 1]]
# protection -- split create 1, 2 and more than 2 columns
# former append when the author name is 'ATLAS collaboration'
df1 = df.a.str.split(u",", expand=True)
if df1.shape[1] < 2:
continue
df[columns4names] = df1[[0, 1]]
df["fmt_name"] = df.a
df.first_name = df.first_name.str.strip()
......@@ -226,7 +232,12 @@ class RecordPubli(Record):
d700 = d100
else:
d100 = d700 = DataFrame({"a": [""], "u": [""]})
d100 = d700 = DataFrame({
"a": [""],
"first_name": [""],
"fmt_name": [""],
"last_name": [""],
"u": [""]})
# ....................................................................
#
......
# -*- coding: utf-8 -*-
"""TALK
http://cds.cern.ch/record/2241325
Search for ttH production (H-> bb) at the ATLAS experiment
ATLAS Collaboration
Epiphany 2017
No corrections are applied to the record.
Allow to test the brute force decoding with its mistakes.
Note:
* First author not defined and equal to ATLAS Collaboration
* No author defined
* No conference defined
"""
import pytest
from invenio_tools import load_record, RecordConf
@pytest.fixture(scope="module")
def record():
return load_record('cds.cern.ch', 2241325)
def test_affiliations(record):
assert record.is_affiliations() == False
assert record.is_affiliation_for_all() == False
def test_authors(record):
assert record.authors() == ""
def test_first_author(record):
assert record.first_author() == ""
def test_first_author_institutes(record):
assert record.first_author_institutes() == ""
# -*- coding: utf-8 -*-
"""TALK
http://cds.cern.ch/record/2260981
Measurement of WW/WZ production in semileptonic decay channels
and search for anomalous gauge couplings with the ATLAS detector at 8 TeV
ATLAS Collaboration
Spalla, Margherita
Epiphany 2017
No corrections are applied to the record.
Allow to test the brute force decoding with its mistakes.
Note:
* First author not defined and equal to ATLAS Collaboration
* One author defined
* No conference defined
"""
import pytest
from invenio_tools import load_record, RecordConf
@pytest.fixture(scope="module")
def record():
return load_record('cds.cern.ch', 2260981)
def test_affiliations(record):
assert record.is_affiliations() == True
assert record.is_affiliation_for_all() == True
def test_authors(record):
assert record.authors() == u"Spalla, Margherita"
def test_first_author(record):
assert record.first_author() == u"Spalla, Margherita"
def test_first_author_institutes(record):
assert record.first_author_institutes() == "INFN Pisa and Universita' di Pisa, Dipartimento di Fisica"
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