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
c620ca3c
Commit
c620ca3c
authored
Jan 28, 2020
by
LE GAC Renaud
Browse files
Update tests/basis.
parent
6805216d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
46 deletions
+46
-46
tests/basis/test_02_record_factory.py
tests/basis/test_02_record_factory.py
+3
-5
tests/basis/test_04_RecordPubli.py
tests/basis/test_04_RecordPubli.py
+24
-24
tests/basis/test_09_Automaton.py
tests/basis/test_09_Automaton.py
+6
-6
tests/basis/test_10_CheckAndFix_article.py
tests/basis/test_10_CheckAndFix_article.py
+11
-11
tests/pytest.ini
tests/pytest.ini
+2
-0
No files found.
tests/basis/test_02_record_factory.py
View file @
c620ca3c
...
...
@@ -179,11 +179,9 @@ def test_add_affiliation_keys_ins_02009():
add_affiliation_keys
(
recjson
)
assert
u
"corporate_note"
in
recjson
assert
recjson
[
u
"corporate_note"
][
u
"identifier"
]
==
"Marseille, CPPM"
assert
recjson
[
u
"corporate_note"
][
u
"future_identifier"
]
==
\
"CPPM, Marseille"
assert
"corporate_note"
in
recjson
assert
recjson
[
"corporate_note"
][
"identifier"
]
==
"Marseille, CPPM"
assert
recjson
[
"corporate_note"
][
"future_identifier"
]
==
"CPPM, Marseille"
def
test_institute_ins_02010
():
...
...
tests/basis/test_04_RecordPubli.py
View file @
c620ca3c
...
...
@@ -53,7 +53,7 @@ def test_constructor_cds_04001(reccds):
assert
len
(
authors
.
columns
.
difference
(
refcols
))
==
0
assert
len
(
authors
)
==
reccds
[
"number_of_authors"
]
assert
authors
.
affiliation
.
iloc
[
12
]
==
u
"INFN, Rome|CERN"
assert
authors
.
affiliation
.
iloc
[
12
]
==
"INFN, Rome|CERN"
papers
=
reccds
[
"publication_info"
]
...
...
@@ -69,12 +69,12 @@ def test_constructor_cds_04001(reccds):
def
test_to_initial_04002
():
assert
to_initial
(
u
"Albert"
)
==
u
"A."
assert
to_initial
(
u
"Antonio Augusto"
)
==
u
"A. A."
assert
to_initial
(
u
"Kristof Antoon M"
)
==
u
"K. A. M."
assert
to_initial
(
u
"Jean-Pierre"
)
==
u
"J.-P."
assert
to_initial
(
u
"Marie-Hélène"
)
==
u
"M.-H."
assert
to_initial
(
u
"Marie - Pierre"
)
==
u
"M.-P."
assert
to_initial
(
"Albert"
)
==
"A."
assert
to_initial
(
"Antonio Augusto"
)
==
"A. A."
assert
to_initial
(
"Kristof Antoon M"
)
==
"K. A. M."
assert
to_initial
(
"Jean-Pierre"
)
==
"J.-P."
assert
to_initial
(
"Marie-Hélène"
)
==
"M.-H."
assert
to_initial
(
"Marie - Pierre"
)
==
"M.-P."
# ............................................................................
...
...
@@ -89,19 +89,19 @@ def test_authors_as_list_cds_04004(reccds):
authors
=
reccds
.
authors_as_list
()
assert
len
(
authors
)
==
reccds
[
"number_of_authors"
]
assert
authors
[
0
]
==
u
"Aaij, Roel"
assert
authors
[
1
]
==
u
"Adeva, Bernardo"
assert
authors
[
344
]
==
u
"Le Gac, Renaud"
assert
authors
[
-
1
]
==
u
"Zvyagin, Alexander"
assert
authors
[
0
]
==
"Aaij, Roel"
assert
authors
[
1
]
==
"Adeva, Bernardo"
assert
authors
[
344
]
==
"Le Gac, Renaud"
assert
authors
[
-
1
]
==
"Zvyagin, Alexander"
def
test_first_author_cds_04005
(
reccds
):
assert
reccds
.
first_author
()
==
u
"Aaij, Roel"
assert
reccds
.
first_author
()
==
"Aaij, Roel"
def
test_find_authors_cds_04006
(
reccds
):
assert
reccds
.
find_authors
(
"Leo"
)
==
\
u
"Beaucourt, Leo, Kravchuk, Leonid, Leo, Sabato"
"Beaucourt, Leo, Kravchuk, Leonid, Leo, Sabato"
def
test_reformat_author_cds_04007
(
reccds
):
...
...
@@ -110,11 +110,11 @@ def test_reformat_author_cds_04007(reccds):
authors
=
reccds
.
authors_as_list
()
assert
len
(
authors
)
==
reccds
[
"number_of_authors"
]
assert
authors
[
0
]
==
u
"R. Aaij"
assert
authors
[
1
]
==
u
"B. Adeva"
assert
authors
[
12
]
==
u
"A. A. Alves Jr"
assert
authors
[
344
]
==
u
"R. Le Gac"
assert
authors
[
-
1
]
==
u
"A. Zvyagin"
assert
authors
[
0
]
==
"R. Aaij"
assert
authors
[
1
]
==
"B. Adeva"
assert
authors
[
12
]
==
"A. A. Alves Jr"
assert
authors
[
344
]
==
"R. Le Gac"
assert
authors
[
-
1
]
==
"A. Zvyagin"
reccds
.
reformat_authors
(
"Last, First"
)
...
...
@@ -152,13 +152,13 @@ def test_first_author_institutes_cds_04011(reccds):
def
test_find_authors_by_affiliation_cds_04012
(
reccds
):
pattern
=
"CPPM, Marseille|Marseille, CPPM"
authors
=
reccds
.
find_authors_by_affiliation
(
pattern
,
sep
=
u
"|"
)
authors
=
reccds
.
find_authors_by_affiliation
(
pattern
,
sep
=
"|"
)
assert
authors
==
u
"Akar, Simon|Aslanides, Elie|Cogan, Julien|"
\
u
"Kanso, Walaa|Le Gac, Renaud|Leroy, Olivier|"
\
u
"Mancinelli, Giampiero|Mordà, Alessandro|"
\
u
"Perrin-Terrin, Mathieu|Serrano, Justine|"
\
u
"Tsaregorodtsev, Andrei"
assert
authors
==
"Akar, Simon|Aslanides, Elie|Cogan, Julien|"
\
"Kanso, Walaa|Le Gac, Renaud|Leroy, Olivier|"
\
"Mancinelli, Giampiero|Mordà, Alessandro|"
\
"Perrin-Terrin, Mathieu|Serrano, Justine|"
\
"Tsaregorodtsev, Andrei"
# ............................................................................
...
...
tests/basis/test_09_Automaton.py
View file @
c620ca3c
...
...
@@ -70,9 +70,9 @@ def test_process_recid_09002(svc):
svc
.
logs
=
[]
# mimic high level stage process_collection and process_url
collection
=
u
"LHCb Papers"
collection
=
"LHCb Papers"
svc
.
harvester
.
host
=
u
"cds.cern.ch"
svc
.
harvester
.
host
=
"cds.cern.ch"
svc
.
harvester
.
collections
=
collection
svc
.
store
=
InvenioStore
()
...
...
@@ -104,15 +104,15 @@ def test_process_recid_09002(svc):
def
test_process_collection_09003
(
svc
):
# mimic the previous stage process_url
collection
=
u
"LHCb Papers"
collection
=
"LHCb Papers"
svc
.
harvester
.
host
=
u
"cds.cern.ch"
svc
.
harvester
.
host
=
"cds.cern.ch"
svc
.
harvester
.
collections
=
collection
svc
.
store
=
InvenioStore
()
# do it
svc
.
dbg
=
True
assert
svc
.
process_collection
(
u
"LHCb Papers"
)
is
None
assert
svc
.
process_collection
(
"LHCb Papers"
)
is
None
# reset
svc
.
collection_logs
=
[]
...
...
@@ -124,7 +124,7 @@ def test_process_collection_09003(svc):
def
test_process_url_cds_09004
(
svc
):
svc
.
dbg
=
True
assert
svc
.
process_url
(
"cds.cern.ch"
,
u
"LHCb Papers"
)
is
None
assert
svc
.
process_url
(
"cds.cern.ch"
,
"LHCb Papers"
)
is
None
def
test_process_url_ins_09005
(
svc
):
...
...
tests/basis/test_10_CheckAndFix_article.py
View file @
c620ca3c
...
...
@@ -79,12 +79,12 @@ def test_submitted_cds_10005(svc, reccds):
assert
reccds
.
submitted
()
==
"2017-01-19"
# test the case 19 01 2017
reccds
[
u
"prepublication"
][
u
"date"
]
=
"19 01 2017"
reccds
[
"prepublication"
][
"date"
]
=
"19 01 2017"
svc
.
submitted
(
reccds
)
assert
reccds
.
submitted
()
==
"2017-01-19"
# test the case 2017
reccds
[
u
"prepublication"
][
u
"date"
]
=
"2017"
reccds
[
"prepublication"
][
"date"
]
=
"2017"
svc
.
submitted
(
reccds
)
assert
reccds
.
submitted
()
==
"2017-01"
...
...
@@ -99,24 +99,24 @@ def test_format_authors_cds_10007(svc, reccds):
authors
=
reccds
.
authors_as_list
()
assert
len
(
authors
)
==
reccds
[
"number_of_authors"
]
assert
authors
[
0
]
==
u
"Aaij, Roel"
assert
authors
[
1
]
==
u
"Adeva, Bernardo"
assert
authors
[
344
]
==
u
"Koopman, Rose"
assert
authors
[
-
1
]
==
u
"Zucchelli, Stefano"
assert
authors
[
0
]
==
"Aaij, Roel"
assert
authors
[
1
]
==
"Adeva, Bernardo"
assert
authors
[
344
]
==
"Koopman, Rose"
assert
authors
[
-
1
]
==
"Zucchelli, Stefano"
svc
.
format_authors
(
reccds
,
fmt
=
"F. Last"
)
authors
=
reccds
.
authors_as_list
()
assert
authors
[
0
]
==
u
"R. Aaij"
assert
authors
[
1
]
==
u
"B. Adeva"
assert
authors
[
344
]
==
u
"R. Koopman"
assert
authors
[
-
1
]
==
u
"S. Zucchelli"
assert
authors
[
0
]
==
"R. Aaij"
assert
authors
[
1
]
==
"B. Adeva"
assert
authors
[
344
]
==
"R. Koopman"
assert
authors
[
-
1
]
==
"S. Zucchelli"
def
test_get_my_authors_cds_10008
(
svc
,
reccds
):
svc
.
format_authors
(
reccds
,
fmt
=
"F. Last"
)
assert
svc
.
get_my_authors
(
reccds
,
sep
=
u
"|"
,
sort
=
True
)
is
None
assert
svc
.
get_my_authors
(
reccds
,
sep
=
"|"
,
sort
=
True
)
is
None
my_authors
=
reccds
.
my_authors
...
...
tests/pytest.ini
View file @
c620ca3c
[pytest]
addopts
=
--verbose
cache_dir
=
/tmp/pytest_cache/
console_output_style
=
classic
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