Exemple #1
0
 def test_datetime_to_zkctime__should_convert_datetime(self, value, expect):
     assert ZKDatetimeUtils.datetime_to_zkctime(value) == expect
Exemple #2
0
 def test_datetime_to_zkctime__if_date_less_than_2000_year__should_raise_error(self):
     with pytest.raises(ValueError):
         ZKDatetimeUtils.datetime_to_zkctime(datetime(1999, 12, 31, 23, 59, 59))
Exemple #3
0
 def test_datetime_to_zktimemoment__should_convert_to_zktimemoment(self, value, expect):
     assert ZKDatetimeUtils.datetime_to_zktimemoment(value) == expect
Exemple #4
0
 def test_zkctime_to_datetime__if_value_is_negative__should_raise_error(self):
     with pytest.raises(ValueError):
         ZKDatetimeUtils.zkctime_to_datetime(-1)
Exemple #5
0
 def test_zktimemoment_to_datetime__on_bad_value_type__should_raise_error(self, value):
     with pytest.raises(TypeError):
         ZKDatetimeUtils.zktimemoment_to_datetime(value)
Exemple #6
0
 def test_zktimemoment_to_datetime__on_bad_value__should_raise_error(self):
     with pytest.raises(ValueError):
         ZKDatetimeUtils.zktimemoment_to_datetime('')
Exemple #7
0
 def test_date_to_zkdate__should_convert_to_zkdate(self, value):
     assert ZKDatetimeUtils.date_to_zkdate(value) == '20200412'
Exemple #8
0
 def test_zktimemoment_to_datetime__on_empty_value__should_return_none(self):
     assert ZKDatetimeUtils.zktimemoment_to_datetime(0) is None
Exemple #9
0
 def test_zkdate_to_date__should_convert_to_date(self):
     assert ZKDatetimeUtils.zkdate_to_date('20200412') == date(2020, 4, 12)
Exemple #10
0
 def test_zkdate_to_date__on_empty_value__should_return_none(self):
     assert ZKDatetimeUtils.zkdate_to_date('0') is None
Exemple #11
0
 def test_times_to_zktimerange__should_convert_to_zktimerange(self, value, expect):
     assert ZKDatetimeUtils.times_to_zktimerange(*value) == expect
Exemple #12
0
 def test_zktimerange_to_times__if_value_less_that_zero__should_raise_error(self):
     with pytest.raises(ValueError):
         ZKDatetimeUtils.zktimerange_to_times(-1)
Exemple #13
0
 def test_zktimerange_to_times__should_convert_to_time_ranges(self, value, expect):
     assert ZKDatetimeUtils.zktimerange_to_times(value) == expect
Exemple #14
0
 def test_time_string_to_datetime__if_value_is_invalid__should_raise_error(self, value):
     with pytest.raises(ValueError):
         ZKDatetimeUtils.time_string_to_datetime(value)
Exemple #15
0
 def test_time_string_to_datetime__should_convert_datetime(self, value, expect):
     assert ZKDatetimeUtils.time_string_to_datetime(value) == expect