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
b9260798
Commit
b9260798
authored
Sep 20, 2015
by
LE GAC Renaud
Browse files
Propagate new Record classes in tests and CheckAndFix.
parent
d2a8a4fb
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
32 additions
and
42 deletions
+32
-42
modules/harvest_tools/preprints.py
modules/harvest_tools/preprints.py
+3
-3
modules/harvest_tools/thesis.py
modules/harvest_tools/thesis.py
+2
-2
modules/invenio_tools/checkandfix.py
modules/invenio_tools/checkandfix.py
+8
-9
tests/harvester/CheckAndFix/test_phd_cds1394605_fix.py
tests/harvester/CheckAndFix/test_phd_cds1394605_fix.py
+2
-2
tests/harvester/CheckAndFix/test_phd_cds1642541_fix.py
tests/harvester/CheckAndFix/test_phd_cds1642541_fix.py
+2
-2
tests/harvester/Record/test_acl_cds1951625.py
tests/harvester/Record/test_acl_cds1951625.py
+2
-3
tests/harvester/Record/test_acl_ins1319638.py
tests/harvester/Record/test_acl_ins1319638.py
+2
-3
tests/harvester/Record/test_acti_cds1411352.py
tests/harvester/Record/test_acti_cds1411352.py
+3
-5
tests/harvester/Record/test_acti_ins1276938.py
tests/harvester/Record/test_acti_ins1276938.py
+3
-5
tests/harvester/Record/test_com_cds1550918.py
tests/harvester/Record/test_com_cds1550918.py
+3
-5
tests/harvester/Record/test_phd_cds1632177.py
tests/harvester/Record/test_phd_cds1632177.py
+2
-3
No files found.
modules/harvest_tools/preprints.py
View file @
b9260798
...
...
@@ -6,7 +6,7 @@ import traceback
from
base
import
family_name_fr
,
MSG_CRASH
,
MSG_LOAD
from
invenio_tools
import
CheckException
from
invenio_tools
import
CheckException
,
RecordConf
,
RecordThesis
from
publicationstool
import
PublicationsTool
from
plugin_dbui
import
UNDEF_ID
...
...
@@ -100,11 +100,11 @@ class Preprints(PublicationsTool):
self
.
logs
[
-
1
].
reject
(
MSG_PREPRINT_IS_PAPER
,
record
.
year
())
return
False
if
record
.
is_conference_data
(
):
if
isinstance
(
record
,
RecordConf
):
self
.
logs
[
-
1
].
reject
(
MSG_PREPRINT_IS_CONFERENCE
,
record
.
year
())
return
False
if
record
.
is_t
hesis
(
):
if
isinstance
(
record
,
RecordT
hesis
):
self
.
logs
[
-
1
].
reject
(
MSG_PREPRINT_IS_THESIS
,
record
.
year
())
return
False
...
...
modules/harvest_tools/thesis.py
View file @
b9260798
...
...
@@ -7,7 +7,7 @@ import traceback
from
base
import
family_name_fr
,
MSG_CRASH
,
MSG_LOAD
from
invenio_tools
import
CheckException
from
invenio_tools
import
CheckException
,
RecordThesis
from
publicationstool
import
PublicationsTool
from
plugin_dbui
import
get_id
,
UNDEF_ID
...
...
@@ -113,7 +113,7 @@ class Thesis(PublicationsTool):
if
self
.
dbg
:
print
"select thesis record"
if
record
.
is_t
hesis
(
):
if
isinstance
(
record
,
RecordT
hesis
):
return
True
self
.
logs
[
-
1
].
reject
(
MSG_NO_THESIS
,
record
.
year
())
...
...
modules/invenio_tools/checkandfix.py
View file @
b9260798
...
...
@@ -5,13 +5,15 @@
import
re
import
regex
from
base
import
is_conference
,
OAI_URL
,
REG_OAI
,
REG_YEAR
from
base
import
OAI_URL
,
REG_OAI
,
REG_YEAR
from
exception
import
CheckException
from
filters
import
CLEAN_REVIEW
from
gluon
import
current
from
inveniostore
import
InvenioStore
from
marc12
import
Marc12
from
plugin_dbui
import
get_id
from
recordconf
import
RecordConf
from
recordthesis
import
RecordThesis
DECODE_ARXIV
=
re
.
compile
(
"arXiv:(\d{2})(\d{2})\."
)
...
...
@@ -116,7 +118,7 @@ class CheckAndFix(object):
"""
val
=
u
''
if
record
.
is_conference_data
(
):
if
isinstance
(
record
,
RecordConf
):
# INSPIREHEP start date encoded as 2014-12-31
if
"x"
in
record
[
"111"
]:
...
...
@@ -127,7 +129,7 @@ class CheckAndFix(object):
val
=
record
[
"111"
][
"z"
]
val
=
"%s-%s-%s"
%
(
val
[
0
:
4
],
val
[
4
:
6
],
val
[
6
:
8
])
elif
record
.
is_t
hesis
(
):
elif
isinstance
(
record
,
RecordT
hesis
):
val
=
record
.
these_defense
()
else
:
...
...
@@ -286,10 +288,7 @@ class CheckAndFix(object):
raise
CheckException
(
MSG_WELL_FORMED_COLLABORATION
)
def
conference
(
self
,
record
):
"""Get the conference data associated to a talk/proceeding and
push them in the record.
@note: the conference is looks by its key.
"""check country and conference date
@type record: L{Record}
@param record:
...
...
@@ -298,7 +297,7 @@ class CheckAndFix(object):
"""
# conference information are available, i.e proceeding
if
not
is
_conference
(
r
ecord
):
if
not
is
instance
(
record
,
R
ecord
Conf
):
return
# check country information (all valid countries have been enter once)
...
...
@@ -421,7 +420,7 @@ class CheckAndFix(object):
"""
# protection
if
not
record
.
is_t
hesis
(
):
if
not
isinstance
(
record
,
RecordT
hesis
):
return
# CPPM: fix the name of Aix-Marseille university
...
...
tests/harvester/CheckAndFix/test_phd_cds1394605_fix.py
View file @
b9260798
...
...
@@ -19,7 +19,7 @@ import pytest
from
harvest_tools
import
format_author_fr
from
invenio_tools
import
CheckAndFix
,
load_record
from
invenio_tools
import
CheckAndFix
,
load_record
,
RecordThesis
@
pytest
.
fixture
(
scope
=
"module"
)
...
...
@@ -55,7 +55,7 @@ def test_these_directors(record):
def
test_is_thesis
(
record
):
assert
record
.
is_t
hesis
(
)
assert
isinstance
(
record
,
RecordT
hesis
)
def
test_submitted
(
record
):
...
...
tests/harvester/CheckAndFix/test_phd_cds1642541_fix.py
View file @
b9260798
...
...
@@ -19,7 +19,7 @@ import pytest
from
harvest_tools
import
format_author_fr
from
invenio_tools
import
CheckAndFix
,
load_record
from
invenio_tools
import
CheckAndFix
,
load_record
,
RecordThesis
@
pytest
.
fixture
(
scope
=
"module"
)
...
...
@@ -55,7 +55,7 @@ def test_these_directors(record):
def
test_is_thesis
(
record
):
assert
record
.
is_t
hesis
(
)
assert
isinstance
(
record
,
RecordT
hesis
)
def
test_submitted
(
record
):
...
...
tests/harvester/Record/test_acl_cds1951625.py
View file @
b9260798
...
...
@@ -23,7 +23,7 @@ Note:
import
pytest
from
invenio_tools
import
load_record
from
invenio_tools
import
load_record
,
RecordPubli
@
pytest
.
fixture
(
scope
=
"module"
)
...
...
@@ -71,9 +71,8 @@ def test_institutes(record):
def
test_is_article
(
record
):
assert
record
.
is_conference_data
()
==
False
assert
isinstance
(
record
,
RecordPubli
)
assert
record
.
is_published
()
==
True
assert
record
.
is_thesis
()
==
False
def
test_oai
(
record
):
...
...
tests/harvester/Record/test_acl_ins1319638.py
View file @
b9260798
...
...
@@ -22,7 +22,7 @@ Note:
import
pytest
from
invenio_tools
import
load_record
from
invenio_tools
import
load_record
,
RecordPubli
@
pytest
.
fixture
(
scope
=
"module"
)
...
...
@@ -69,9 +69,8 @@ def test_institutes(record):
def
test_is_article
(
record
):
assert
record
.
is_conference_data
()
==
False
assert
isinstance
(
record
,
RecordPubli
)
assert
record
.
is_published
()
==
True
assert
record
.
is_thesis
()
==
False
def
test_oai
(
record
):
...
...
tests/harvester/Record/test_acti_cds1411352.py
View file @
b9260798
...
...
@@ -18,13 +18,12 @@ Note:
"""
import
pytest
from
invenio_tools
import
load_record
from
invenio_tools
import
load_record
,
RecordConf
@
pytest
.
fixture
(
scope
=
"module"
)
def
record
():
rec
=
load_record
(
'cds.cern.ch'
,
1411352
)
return
rec
return
load_record
(
'cds.cern.ch'
,
1411352
)
def
test_authors
(
record
):
...
...
@@ -88,9 +87,8 @@ def test_institutes(record):
assert
record
.
is_institute_defined
()
==
False
def
test_is_proceeding
(
record
):
assert
record
.
is_conference_data
()
==
True
assert
isinstance
(
record
,
RecordConf
)
assert
record
.
is_published
()
==
True
assert
record
.
is_thesis
()
==
False
def
test_oai
(
record
):
...
...
tests/harvester/Record/test_acti_ins1276938.py
View file @
b9260798
...
...
@@ -20,13 +20,12 @@ Note:
"""
import
pytest
from
invenio_tools
import
load_record
from
invenio_tools
import
load_record
,
RecordConf
@
pytest
.
fixture
(
scope
=
"module"
)
def
record
():
rec
=
load_record
(
'inspirehep.net'
,
1276938
)
return
rec
return
load_record
(
'inspirehep.net'
,
1276938
)
def
test_authors
(
record
):
...
...
@@ -93,9 +92,8 @@ def test_institutes(record):
def
test_is_proceeding
(
record
):
assert
record
.
is_conference_data
()
==
True
assert
isinstance
(
record
,
RecordConf
)
assert
record
.
is_published
()
==
False
assert
record
.
is_thesis
()
==
False
def
test_oai
(
record
):
...
...
tests/harvester/Record/test_com_cds1550918.py
View file @
b9260798
...
...
@@ -16,13 +16,12 @@ Note:
import
pytest
from
invenio_tools
import
load_record
from
invenio_tools
import
load_record
,
RecordConf
@
pytest
.
fixture
(
scope
=
"module"
)
def
record
():
rec
=
load_record
(
'cds.cern.ch'
,
1550918
)
return
rec
return
load_record
(
'cds.cern.ch'
,
1550918
)
def
test_authors
(
record
):
...
...
@@ -89,9 +88,8 @@ def test_institutes(record):
def
test_is_proceeding
(
record
):
assert
record
.
is_conference_data
()
==
True
assert
isinstance
(
record
,
RecordConf
)
assert
record
.
is_published
()
==
False
assert
record
.
is_thesis
()
==
False
def
test_oai
(
record
):
...
...
tests/harvester/Record/test_phd_cds1632177.py
View file @
b9260798
...
...
@@ -20,7 +20,7 @@ Note:
import
pytest
from
invenio_tools
import
load_record
from
invenio_tools
import
load_record
,
RecordThesis
@
pytest
.
fixture
(
scope
=
"module"
)
...
...
@@ -62,9 +62,8 @@ def test_institutes(record):
def
test_is_phd
(
record
):
assert
record
.
is_conference_data
()
==
False
assert
isinstance
(
record
,
RecordThesis
)
assert
record
.
is_published
()
==
False
assert
record
.
is_thesis
()
==
True
def
test_oai
(
record
):
...
...
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