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
7e3939b4
Commit
7e3939b4
authored
Jan 06, 2021
by
LE GAC Renaud
Browse files
Update test_01_InvenioStore
parent
715ea1c7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
22 deletions
+16
-22
modules/store_tools/inspirehepstore.py
modules/store_tools/inspirehepstore.py
+8
-3
tests/basis/test_01_InvenioStore.py
tests/basis/test_01_InvenioStore.py
+8
-19
No files found.
modules/store_tools/inspirehepstore.py
View file @
7e3939b4
...
...
@@ -165,9 +165,14 @@ class InspirehepStore(BaseStore):
or ``mostcited`` for ``literature``
Returns:
* list of JSON records
The record format is defined in:
https://inspire-schemas.readthedocs.io/en/latest/schemas/
* list of dict:
- id (str)
- created (str)
- links (dict)
- metadata (dict)
The record format is defined in:
https://inspire-schemas.readthedocs.io/en/latest/schemas/
- updated (str)
Raises:
CdsException:
...
...
tests/basis/test_01_InvenioStore.py
View file @
7e3939b4
...
...
@@ -48,26 +48,17 @@ def test_get_ids_ins_01003():
"""Check the list of record ids for LHCb articles published in 2010.
"""
store
=
build_store
(
"inspirehep.net"
)
query
=
"find cn lhcb and tc p and not tc c and date 2010"
kwargs
=
{
"p"
:
query
,
# query à la spires
"rg"
:
1000
,
# maximum number of records returned
"sf"
:
"year"
,
# sort by date
"so"
:
"d"
}
# descending order
rec_ids
=
store
.
get_ids
(
**
kwargs
)
store
=
build_store
(
"inspirehep.net"
,
shelf
=
"literature"
)
ids
=
store
.
get_ids
(
q
=
"find cn lhcb and tc p and not tc c and date 2010"
)
ref_2019_ids
=
{
865584
,
867355
,
867647
}
assert
set
(
rec_ids
).
difference
(
ref_2019_ids
)
==
set
()
assert
set
(
ids
)
==
ref_2019_ids
def
test_get_ids_exception_01004
():
store
=
build_store
(
"inspirehep.net"
,
shelf
=
"conferences"
)
with
pytest
.
raises
(
CdsException
)
as
e_info
:
store
.
get_ids
(
p
=
"find cn lhcb"
)
assert
store
.
get_ids
(
q
=
"find cn lhcb"
)
==
[]
def
test_get_record_cds_01005
():
...
...
@@ -94,7 +85,7 @@ def test_get_record_ins_conferences_01008():
# new inspirehep interface for conferences
store
=
build_store
(
"inspirehep.net"
,
shelf
=
"conferences"
)
recjson
=
store
.
get_record
(
980401
)
assert
recjson
[
"
metadata"
][
"
cnum"
]
==
"C10-12-06"
assert
recjson
[
"cnum"
]
==
"C10-12-06"
def
test_get_record_ins_institutions_01009
():
...
...
@@ -105,15 +96,13 @@ def test_get_record_ins_institutions_01009():
def
test_get_field_ins_01010
():
# old inspirehep interface (new one not yet available)
store
=
build_store
(
"inspirehep.net"
,
shelf
=
"literature"
)
value
=
store
.
get_field
(
1319638
,
"number_of_citations"
)
assert
str
(
value
).
isdigit
()
value
=
store
.
get_field
(
1319638
,
"citation_count"
)
assert
isinstance
(
value
,
int
)
def
test_search_ins_01011
():
# new inspirehep interface for conferences
store
=
build_store
(
"inspirehep.net"
,
shelf
=
"conferences"
)
obj
=
store
.
search
(
"cnum:C10-12-06"
)
obj
=
store
.
search
(
q
=
"cnum:C10-12-06"
)
assert
len
(
obj
)
==
1
and
obj
[
0
][
"metadata"
][
"cnum"
]
==
"C10-12-06"
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