Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
limbra
limbra
Commits
123eed1b
Commit
123eed1b
authored
Jun 07, 2017
by
LE GAC Renaud
Browse files
Update RecordPubli to add protection in _process_authors.
parent
a79e38ca
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
103 additions
and
3 deletions
+103
-3
modules/invenio_tools/recordpubli.py
modules/invenio_tools/recordpubli.py
+14
-3
tests/invenio_tools/Record/test_com_cds2241325.py
tests/invenio_tools/Record/test_com_cds2241325.py
+44
-0
tests/invenio_tools/Record/test_com_cds2260981.py
tests/invenio_tools/Record/test_com_cds2260981.py
+45
-0
No files found.
modules/invenio_tools/recordpubli.py
View file @
123eed1b
...
...
@@ -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"
:
[
""
]})
# ....................................................................
#
...
...
tests/invenio_tools/Record/test_com_cds2241325.py
0 → 100644
View file @
123eed1b
# -*- 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
()
==
""
tests/invenio_tools/Record/test_com_cds2260981.py
0 → 100644
View file @
123eed1b
# -*- 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"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment