Page MenuHomeSoftware Heritage

D2914.diff
No OneTemporary

D2914.diff

diff --git a/swh/storage/tests/storage_data.py b/swh/storage/tests/storage_data.py
--- a/swh/storage/tests/storage_data.py
+++ b/swh/storage/tests/storage_data.py
@@ -199,7 +199,9 @@
'fullname': b'Nicolas Dandrimont <nicolas@example.com> ',
},
'date': {
- 'timestamp': 1234567890,
+ 'timestamp': {
+ 'seconds': 1234567890,
+ 'microseconds': 0},
'offset': 120,
'negative_utc': False,
},
@@ -209,7 +211,9 @@
'fullname': b'St\xc3fano Zacchiroli <stefano@example.com>'
},
'committer_date': {
- 'timestamp': 1123456789,
+ 'timestamp': {
+ 'seconds': 1123456789,
+ 'microseconds': 0},
'offset': 0,
'negative_utc': True,
},
@@ -253,7 +257,9 @@
'fullname': b'tony <ar@dumont.fr>',
},
'committer_date': {
- 'timestamp': 1123456789,
+ 'timestamp': {
+ 'seconds': 1123456789,
+ 'microseconds': 0},
'offset': 0,
'negative_utc': False,
},
@@ -287,7 +293,9 @@
'fullname': b'tony <ar@dumont.fr>',
},
'committer_date': {
- 'timestamp': 1127351742,
+ 'timestamp': {
+ 'seconds': 1127351742,
+ 'microseconds': 0},
'offset': 0,
'negative_utc': False,
},
@@ -389,7 +397,9 @@
'fullname': b'olasd <nic@olasd.fr>',
},
'date': {
- 'timestamp': 1234567890,
+ 'timestamp': {
+ 'seconds': 1234567890,
+ 'microseconds': 0},
'offset': 42,
'negative_utc': False,
},
@@ -408,7 +418,9 @@
'fullname': b'tony <ar@dumont.fr>',
},
'date': {
- 'timestamp': 1634366813,
+ 'timestamp': {
+ 'seconds': 1634366813,
+ 'microseconds': 0},
'offset': -120,
'negative_utc': False,
},
@@ -427,7 +439,9 @@
'fullname': b'tony <tony@ardumont.fr>',
},
'date': {
- 'timestamp': 1634336813,
+ 'timestamp': {
+ 'seconds': 1634336813,
+ 'microseconds': 0},
'offset': 0,
'negative_utc': False,
},
diff --git a/swh/storage/tests/test_converters.py b/swh/storage/tests/test_converters.py
--- a/swh/storage/tests/test_converters.py
+++ b/swh/storage/tests/test_converters.py
@@ -12,6 +12,51 @@
def setUp(self):
self.maxDiff = None
+ def test_date_to_db(self):
+ date_to_db = converters.date_to_db
+ assert date_to_db(None) == {
+ "timestamp": None, "offset": 0, "neg_utc_offset": None}
+
+ assert date_to_db({
+ "timestamp": 1234567890,
+ "offset": 120,
+ "negative_utc": False,
+ }) == {
+ "timestamp": "2009-02-13T23:31:30+00:00",
+ "offset": 120,
+ "neg_utc_offset": False,
+ }
+
+ assert date_to_db({
+ "timestamp": 1123456789,
+ "offset": 0,
+ "negative_utc": True,
+ }) == {
+ "timestamp": "2005-08-07T23:19:49+00:00",
+ "offset": 0,
+ "neg_utc_offset": True,
+ }
+
+ assert date_to_db({
+ "timestamp": 1234567890,
+ "offset": 42,
+ "negative_utc": False,
+ }) == {
+ "timestamp": "2009-02-13T23:31:30+00:00",
+ "offset": 42,
+ "neg_utc_offset": False,
+ }
+
+ assert date_to_db({
+ "timestamp": 1634366813,
+ "offset": -120,
+ "negative_utc": False,
+ }) == {
+ "timestamp": "2021-10-16T06:46:53+00:00",
+ "offset": -120,
+ "neg_utc_offset": False,
+ }
+
def test_db_to_author(self):
# when
actual_author = converters.db_to_author(

File Metadata

Mime Type
text/plain
Expires
Jul 27 2024, 5:16 PM (11 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3224195

Event Timeline