Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Medizinische Informatik - Öffentliche Projekte
UMG MeDIC
MeDIC Technik
AW Agents
Annotation Agent
Commits
81389f1e
Commit
81389f1e
authored
Aug 21, 2020
by
parciak
Browse files
Fix test_receive.py date parsing wrt. Python3.6 used in CICD
Signed-off-by:
Marcel Parciak
<
marcel.parciak@gmail.com
>
parent
3b0bd29e
Pipeline
#148167
failed with stage
in 6 minutes and 59 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
annotator/test_receive.py
View file @
81389f1e
...
@@ -168,6 +168,21 @@ def test_receive_02(cdstar_archive):
...
@@ -168,6 +168,21 @@ def test_receive_02(cdstar_archive):
# Compare both JSON replies and the data they contain
# Compare both JSON replies and the data they contain
assert
test_utils
.
is_schemaorg_jsonld
(
meta_json
)
assert
test_utils
.
is_schemaorg_jsonld
(
meta_json
)
assert
meta_json
[
"identifier"
]
==
archive_id
assert
meta_json
[
"identifier"
]
==
archive_id
# across python versions, parsing datetimes does not work homogeneously (changed in Python 3.7). Fix this
cdstar_json
[
"created"
]
=
cdstar_json
[
"created"
][:
-
4
]
+
cdstar_json
[
"created"
][
-
4
:
].
replace
(
":"
,
""
)
cdstar_json
[
"modified"
]
=
cdstar_json
[
"modified"
][:
-
4
]
+
cdstar_json
[
"modified"
][
-
4
:
].
replace
(
":"
,
""
)
meta_json
[
"dateCreated"
]
=
meta_json
[
"dateCreated"
][:
-
4
]
+
meta_json
[
"dateCreated"
][
-
4
:
].
replace
(
":"
,
""
)
meta_json
[
"dateModified"
]
=
meta_json
[
"dateModified"
][:
-
4
]
+
meta_json
[
"dateModified"
][
-
4
:].
replace
(
":"
,
""
)
assert
datetime
.
datetime
.
strptime
(
assert
datetime
.
datetime
.
strptime
(
cdstar_json
[
"created"
],
"%Y-%m-%dT%H:%M:%S.%f%z"
cdstar_json
[
"created"
],
"%Y-%m-%dT%H:%M:%S.%f%z"
)
==
datetime
.
datetime
.
strptime
(
meta_json
[
"dateCreated"
],
"%Y-%m-%dT%H:%M:%S.%f%z"
)
)
==
datetime
.
datetime
.
strptime
(
meta_json
[
"dateCreated"
],
"%Y-%m-%dT%H:%M:%S.%f%z"
)
...
@@ -216,6 +231,21 @@ def test_receive_03(cdstar_archive):
...
@@ -216,6 +231,21 @@ def test_receive_03(cdstar_archive):
assert
meta_json
[
"identifier"
]
==
file_info
[
"id"
]
assert
meta_json
[
"identifier"
]
==
file_info
[
"id"
]
assert
file_info
[
"type"
]
==
meta_json
[
"encodingFormat"
]
assert
file_info
[
"type"
]
==
meta_json
[
"encodingFormat"
]
assert
int
(
file_info
[
"size"
])
==
int
(
meta_json
[
"contentSize"
])
assert
int
(
file_info
[
"size"
])
==
int
(
meta_json
[
"contentSize"
])
# across python versions, parsing datetimes does not work homogeneously (changed in Python 3.7). Fix this
file_info
[
"created"
]
=
file_info
[
"created"
][:
-
4
]
+
file_info
[
"created"
][
-
4
:
].
replace
(
":"
,
""
)
file_info
[
"modified"
]
=
file_info
[
"modified"
][:
-
4
]
+
file_info
[
"modified"
][
-
4
:
].
replace
(
":"
,
""
)
meta_json
[
"dateCreated"
]
=
meta_json
[
"dateCreated"
][:
-
4
]
+
meta_json
[
"dateCreated"
][
-
4
:].
replace
(
":"
,
""
)
meta_json
[
"dateModified"
]
=
meta_json
[
"dateModified"
][:
-
4
]
+
meta_json
[
"dateModified"
][
-
4
:].
replace
(
":"
,
""
)
assert
datetime
.
datetime
.
strptime
(
assert
datetime
.
datetime
.
strptime
(
file_info
[
"created"
],
"%Y-%m-%dT%H:%M:%S.%f%z"
file_info
[
"created"
],
"%Y-%m-%dT%H:%M:%S.%f%z"
)
==
datetime
.
datetime
.
strptime
(
)
==
datetime
.
datetime
.
strptime
(
...
@@ -374,4 +404,4 @@ def test_receive_invalid_archive_01():
...
@@ -374,4 +404,4 @@ def test_receive_invalid_archive_01():
# Assume an error message is supplied while no logs or messages are emitted.
# Assume an error message is supplied while no logs or messages are emitted.
assert
len
(
response_data
[
"result"
][
"errors"
])
>=
1
assert
len
(
response_data
[
"result"
][
"errors"
])
>=
1
assert
len
(
response_data
[
"result"
][
"logs"
])
==
0
assert
len
(
response_data
[
"result"
][
"logs"
])
==
0
assert
len
(
response_data
[
"result"
][
"messages"
])
==
0
assert
len
(
response_data
[
"result"
][
"messages"
])
==
0
\ No newline at end of file
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