|
4 | 4 |
|
5 | 5 | import sys
|
6 | 6 | import unittest
|
| 7 | +import datetime |
7 | 8 | import msgpack
|
8 | 9 | import warnings
|
9 | 10 | import tarantool
|
@@ -99,6 +100,42 @@ def setUp(self):
|
99 | 100 | 'tarantool': r"datetime.new({year=2022, month=8, day=31, hour=18, min=7, sec=54, " +
|
100 | 101 | r"nsec=308543321})",
|
101 | 102 | },
|
| 103 | + 'datetime_with_positive_offset': { |
| 104 | + 'python': tarantool.Datetime(year=2022, month=8, day=31, hour=18, minute=7, second=54, |
| 105 | + microsecond=308543, nanosecond=321, |
| 106 | + tzinfo=datetime.timezone(datetime.timedelta(minutes=180))), |
| 107 | + 'msgpack': (b'\x4a\x79\x0f\x63\x00\x00\x00\x00\x59\xff\x63\x12\xb4\x00\x00\x00'), |
| 108 | + 'tarantool': r"datetime.new({year=2022, month=8, day=31, hour=18, min=7, sec=54, " + |
| 109 | + r"nsec=308543321, tzoffset=180})", |
| 110 | + }, |
| 111 | + 'datetime_with_negative_offset': { |
| 112 | + 'python': tarantool.Datetime(year=2022, month=8, day=31, hour=18, minute=7, second=54, |
| 113 | + microsecond=308543, nanosecond=321, |
| 114 | + tzinfo=datetime.timezone(datetime.timedelta(minutes=-60))), |
| 115 | + 'msgpack': (b'\x8a\xb1\x0f\x63\x00\x00\x00\x00\x59\xff\x63\x12\xc4\xff\x00\x00'), |
| 116 | + 'tarantool': r"datetime.new({year=2022, month=8, day=31, hour=18, min=7, sec=54, " + |
| 117 | + r"nsec=308543321, tzoffset=-60})", |
| 118 | + }, |
| 119 | + 'pandas_timestamp_with_positive_offset': { |
| 120 | + 'python': tarantool.Datetime(pandas.Timestamp( |
| 121 | + year=2022, month=8, day=31, hour=18, minute=7, second=54, |
| 122 | + microsecond=308543, nanosecond=321, |
| 123 | + tzinfo=datetime.timezone(datetime.timedelta(minutes=180)) |
| 124 | + )), |
| 125 | + 'msgpack': (b'\x4a\x79\x0f\x63\x00\x00\x00\x00\x59\xff\x63\x12\xb4\x00\x00\x00'), |
| 126 | + 'tarantool': r"datetime.new({year=2022, month=8, day=31, hour=18, min=7, sec=54, " + |
| 127 | + r"nsec=308543321, tzoffset=180})", |
| 128 | + }, |
| 129 | + 'pandas_timestamp_with_negative_offset': { |
| 130 | + 'python': tarantool.Datetime(pandas.Timestamp( |
| 131 | + year=2022, month=8, day=31, hour=18, minute=7, second=54, |
| 132 | + microsecond=308543, nanosecond=321, |
| 133 | + tzinfo=datetime.timezone(datetime.timedelta(minutes=-60)) |
| 134 | + )), |
| 135 | + 'msgpack': (b'\x8a\xb1\x0f\x63\x00\x00\x00\x00\x59\xff\x63\x12\xc4\xff\x00\x00'), |
| 136 | + 'tarantool': r"datetime.new({year=2022, month=8, day=31, hour=18, min=7, sec=54, " + |
| 137 | + r"nsec=308543321, tzoffset=-60})", |
| 138 | + }, |
102 | 139 | }
|
103 | 140 |
|
104 | 141 | def test_msgpack_decode(self):
|
|
0 commit comments