Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: add week interval cases
Add Interval with week encoding test cases and datetime arithmetic week
test case.
  • Loading branch information
DifferentialOrange committed Jul 13, 2023
commit bca64f5704ae2fa0c1ae5365dfea3e4bd3961af5
6 changes: 6 additions & 0 deletions test/suites/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,12 @@ def test_tarantool_datetime_subtraction_different_timezones(self):
'res_add': tarantool.Datetime(year=2009, month=3, day=31),
'res_sub': tarantool.Datetime(year=2009, month=1, day=31),
},
'week': {
'arg_1': tarantool.Datetime(year=2008, month=2, day=3),
'arg_2': tarantool.Interval(week=1),
'res_add': tarantool.Datetime(year=2008, month=2, day=10),
'res_sub': tarantool.Datetime(year=2008, month=1, day=27),
},
}

def test_python_interval_addition(self):
Expand Down
18 changes: 18 additions & 0 deletions test/suites/test_interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,24 @@ def test_interval_positional_init(self):
'msgpack': (b'\x00'),
'tarantool': r"datetime.interval.new({adjust='excess'})",
},
'weeks': {
'python': tarantool.Interval(week=3),
'msgpack': (b'\x02\x02\x03\x08\x01'),
'tarantool': r"datetime.interval.new({week=3})",
},
'date_with_week': {
'python': tarantool.Interval(year=1, month=2, week=3, day=4),
'msgpack': (b'\x05\x00\x01\x01\x02\x02\x03\x03\x04\x08\x01'),
'tarantool': r"datetime.interval.new({year=1, month=2, week=3, day=4})",
},
'datetime_with_week': {
'python': tarantool.Interval(year=1, month=2, week=3, day=4, hour=1, minute=2,
sec=3000, nsec=10000000),
'msgpack': (b'\x09\x00\x01\x01\x02\x02\x03\x03\x04\x04\x01\x05\x02\x06\xcd\x0b\xb8'
b'\x07\xce\x00\x98\x96\x80\x08\x01'),
'tarantool': r"datetime.interval.new({year=1, month=2, week=3, day=4, hour=1, "
r"min=2, sec=3000, nsec=10000000})",
},
}

def test_msgpack_decode(self):
Expand Down