コード例 #1
0
ファイル: aggregation.py プロジェクト: vishalbelsare/modeldb
 def granularity(self, value):
     time_delta = time_utils.parse_duration(value)
     self._granularity = time_delta
コード例 #2
0
 def test_downsample_resolution(self, millis):
     delta = timedelta(milliseconds=millis, microseconds=5)
     with pytest.warns(UserWarning):
         duration = time_utils.parse_duration(delta)
     assert duration == timedelta(milliseconds=millis)
コード例 #3
0
 def test_parse_duration_delta(self, millis):
     delta = timedelta(milliseconds=millis)
     duration = time_utils.parse_duration(delta)
     assert duration == delta
コード例 #4
0
 def test_parse_zero(self):
     zero_dur = time_utils.parse_duration(0)
     assert isinstance(zero_dur, timedelta)
コード例 #5
0
 def test_parse_duration(self):
     one_day = time_utils.parse_duration("1d")
     assert one_day == timedelta(days=1)
コード例 #6
0
 def test_round_trip_from_delta(self, millis):
     delta = timedelta(milliseconds=millis)
     delta_millis = time_utils.duration_millis(delta)
     delta_parsed = time_utils.parse_duration(delta_millis)
     assert delta == delta_parsed