Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9123201
test_utils.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
748 B
Subscribers
None
test_utils.py
View Options
# Copyright (C) 2021 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
import
pytest
from
swh.search.utils
import
parse_and_format_date
@pytest.mark.parametrize
(
"date_str"
,
[
"2021-07-03"
,
"2021-7-03"
,
"2021-07-3"
,
"2021-7-3"
,
"2021-07-03T15:17:08Z"
],
)
def
test_parse_and_format_date_success
(
date_str
):
assert
parse_and_format_date
(
date_str
)
==
"2021-07-03"
@pytest.mark.parametrize
(
"date_str"
,
[
"foo"
,
"2021/07/03"
,
"2021+07+03T15,17,08Z"
],
)
def
test_parse_and_format_date_failure
(
date_str
):
assert
parse_and_format_date
(
date_str
)
is
None
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Sat, Jun 21, 5:09 PM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3241326
Attached To
rDSEA Archive search
Event Timeline
Log In to Comment