Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 58cb6d5b authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update CheckAndFix to improve REG_CONF_DATES.

parent f2b0f773
......@@ -57,10 +57,11 @@ MSG_UNKNOWN_COUNTRY = "Reject country is unknown."
MSG_UNKNOWN_PUBLISHER = "Reject publisher is unknown."
MSG_WELL_FORMED_DATE = "Reject submission date is not well formed"
REG_CONF_DATES_1 = re.compile("(\d+) *-? *(\d+) *([A-Z][a-z]{2}) *(\d{4})")
REG_CONF_DATES_1 = \
re.compile("0?(\d+) *-? *0?(\d+) *([A-Z][a-z]{2})[a-z]* *(\d{4})")
REG_CONF_DATES_2 = \
re.compile("(\d+) *([A-Z][a-z]{2}) *-? *(\d+) *([A-Z][a-z]{2}) *(\d{4})")
re.compile("0?(\d+) *([A-Z][a-z]{2})[a-z]* *-? *0?(\d+) *([A-Z][a-z]{2})[a-z]* *(\d{4})")
REG_DOI = re.compile(r"\d+\.\d+/([a-zA-Z]+)\.(\d+)\.(\w+)")
......@@ -151,18 +152,19 @@ class CheckAndFix(object):
# dates are encoded 29 Feb - 1 Mar 2014
m = REG_CONF_DATES_2.match(val)
if not m:
raise ToolException(MSG_NO_CONF_DATE)
if m:
fmt = "%d-%b-%Y"
fmt = "%d-%b-%Y"
val = "%s-%s-%s" % (m.group(1), m.group(2), m.group(5))
opening = datetime.strptime(val, fmt)
val = "%s-%s-%s" % (m.group(1), m.group(2), m.group(5))
opening = datetime.strptime(val, fmt)
val = "%s-%s-%s" % (m.group(3), m.group(4), m.group(5))
closing = datetime.strptime(val, fmt)
val = "%s-%s-%s" % (m.group(3), m.group(4), m.group(5))
closing = datetime.strptime(val, fmt)
return (opening, closing)
return (opening, closing)
raise ToolException(MSG_NO_CONF_DATE)
def _get_reg_institute(self):
"""Get the regular expression defining the affiliation of my institute.
......
......@@ -69,20 +69,29 @@ def test_conference_date_cds_11005(svc, reccds):
assert reccds.conference_dates() == "6-11 Dec 2010"
def test_conference_date_ins_11006(svc, recins):
def test_conference_date_cds_11006(svc):
reccds = load_record("cds.cern.ch", 2688580)
assert reccds.conference_dates() == "04-06 Sept 2019"
svc.conference_date(reccds)
assert reccds.conference_dates() == "4-6 Sep 2019"
def test_conference_date_ins_11007(svc, recins):
assert recins.conference_dates() == "6-11 Dec 2010"
svc.conference_date(recins)
assert recins.conference_dates() == "6-11 Dec 2010"
def test_submitted_cds_11007(svc, reccds):
def test_submitted_cds_11008(svc, reccds):
assert reccds.submitted() == "05 Jan 2012"
svc.submitted(reccds)
assert reccds.submitted() == "2012-01-05"
def test_submitted_ins_11008(svc, recins):
def test_submitted_ins_11009(svc, recins):
assert recins.submitted() == "2011"
svc.submitted(recins)
assert recins.submitted() == "2010-12-06"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment