Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/tests/test_postgresql_converters.py
# Copyright (C) 2015-2021 The Software Heritage developers | # Copyright (C) 2015-2021 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import datetime | import datetime | ||||
import pytest | import pytest | ||||
from swh.model.identifiers import ExtendedSWHID | |||||
from swh.model.model import ( | from swh.model.model import ( | ||||
ObjectType, | ObjectType, | ||||
Person, | Person, | ||||
Release, | Release, | ||||
Revision, | Revision, | ||||
RevisionType, | RevisionType, | ||||
Timestamp, | Timestamp, | ||||
TimestampWithTimezone, | TimestampWithTimezone, | ||||
) | ) | ||||
from swh.model.swhids import ExtendedSWHID | |||||
from swh.storage.postgresql import converters | from swh.storage.postgresql import converters | ||||
def test_date_to_db(): | def test_date_to_db(): | ||||
date_to_db = converters.date_to_db | date_to_db = converters.date_to_db | ||||
assert date_to_db(None) == {"timestamp": None, "offset": 0, "neg_utc_offset": None} | assert date_to_db(None) == {"timestamp": None, "offset": 0, "neg_utc_offset": None} | ||||
assert date_to_db( | assert date_to_db( | ||||
▲ Show 20 Lines • Show All 173 Lines • Show Last 20 Lines |