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
0a0b3f9d
Commit
0a0b3f9d
authored
Jan 28, 2020
by
LE GAC Renaud
Browse files
Polisg Record, RecordPubli and associated tests.
parent
c620ca3c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
16 deletions
+47
-16
modules/invenio_tools/record.py
modules/invenio_tools/record.py
+1
-3
modules/invenio_tools/recordpubli.py
modules/invenio_tools/recordpubli.py
+2
-12
tests/basis/test_04_RecordPubli.py
tests/basis/test_04_RecordPubli.py
+44
-1
No files found.
modules/invenio_tools/record.py
View file @
0a0b3f9d
...
...
@@ -21,8 +21,6 @@ class Record(dict):
+-----------------------------+-----------------------------+
| field (cds) | field (inspirehep) |
+=============================+=============================+
| | FIXME_OAI |
+-----------------------------+-----------------------------+
| abstract | abstract |
+-----------------------------+-----------------------------+
| accelerator_experiment | accelerator_experiment |
...
...
@@ -69,7 +67,7 @@ class Record(dict):
+-----------------------------+-----------------------------+
| number_of_reviews | number_of_reviews |
+-----------------------------+-----------------------------+
| oai |
|
| oai |
FIXME_OAI
|
+-----------------------------+-----------------------------+
| other_report_number | |
+-----------------------------+-----------------------------+
...
...
modules/invenio_tools/recordpubli.py
View file @
0a0b3f9d
...
...
@@ -660,20 +660,10 @@ class RecordPubli(Record):
the string is empty when no URLs are found.
"""
# depends on the store
# start with CDS looking for the field `url`
if
"url"
in
self
:
data
=
self
[
"url"
]
li
=
(
data
if
isinstance
(
data
,
list
)
else
[
data
])
li
=
[
di
[
"url"
]
for
di
in
li
if
di
[
"description"
]
==
"Preprint"
]
if
len
(
li
)
==
1
:
return
li
[
0
]
# scan the list of files
# work for both stores.
pdf
=
"%s.pdf"
%
self
.
preprint_number
()
pdf
=
f
"
{
self
.
preprint_number
()
}
.pdf"
pdf
=
pdf
.
replace
(
ARXIV
+
":"
,
""
)
li
=
self
.
_get
(
"files"
,
"url"
,
force_list
=
True
)
li
=
[
el
for
el
in
li
if
el
.
endswith
(
pdf
)]
...
...
tests/basis/test_04_RecordPubli.py
View file @
0a0b3f9d
...
...
@@ -204,7 +204,8 @@ def test_preprint_number_ins_04020(recins):
def
test_paper_url_cds_04021
(
reccds
):
assert
reccds
.
paper_url
()
==
"http://arxiv.org/pdf/1410.0149.pdf"
assert
reccds
.
paper_url
()
==
\
"http://cds.cern.ch/record/1951625/files/arXiv:1410.0149.pdf"
def
test_paper_url_ins_04022
(
recins
):
...
...
@@ -231,3 +232,45 @@ def test_submitted_ins_04026(recins):
def
test_title_cds_04027
(
reccds
):
assert
reccds
.
title
()
==
"Precision luminosity measurements at LHCb"
def
test_all_ins_042028
():
"""same article oai:inspirehet.net:1762838 and oai:cds.cern.ch:2698323"""
rec
=
load_record
(
"inspirehep.net"
,
1762838
)
assert
rec
.
title
()
==
\
r
"Updated measurement of decay-time-dependent CP asymmetries "
\
r
"in $D^0 \to K^+K^-$ and $D^0 \to \pi^+\pi^-$ decays"
assert
rec
.
paper_reference
()
==
"Phys.Rev. D101 2020 012005"
assert
rec
.
first_author
()
==
"Aaij, Roel"
assert
rec
.
primary_oai
()
==
"oai:inspirehep.net:1762838"
assert
rec
.
secondary_oai
()
==
"oai:cds.cern.ch:2698323"
assert
rec
.
paper_url
()
==
\
"http://inspirehep.net/record/1762838/files/1911.01114.pdf"
assert
rec
.
preprint_number
()
==
"arXiv:1911.01114"
assert
rec
.
report_number
()
==
"CERN-EP-2019-225, LHCb-PAPER-2019-032"
def
test_all_ins_042029
():
"""same article oai:inspirehet.net:1762838 and oai:cds.cern.ch:2698323"""
rec
=
load_record
(
"cds.cern.ch"
,
2698323
)
assert
rec
.
title
()
==
\
r
"Updated measurement of decay-time-dependent CP asymmetries "
\
r
"in $D^0 \to K^+K^-$ and $D^0 \to \pi^+\pi^-$ decays"
assert
rec
.
paper_reference
()
==
"Phys. Rev. D 101 2020 012005"
assert
rec
.
first_author
()
==
"Aaij, Roel"
assert
rec
.
primary_oai
()
==
"oai:cds.cern.ch:2698323"
assert
rec
.
secondary_oai
()
==
"oai:inspirehep.net:1762838"
assert
rec
.
paper_url
()
==
\
"http://cds.cern.ch/record/2698323/files/1911.01114.pdf"
assert
rec
.
preprint_number
()
==
"arXiv:1911.01114"
assert
rec
.
report_number
()
==
"LHCB-PAPER-2019-032, LHCB-PAPER-2019-032-003"
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