示例#1
0
 def test_from_interval(self):
     assert TimeUnit.from_interval('2second').as_tuple() == (2, SECOND)
     assert TimeUnit.from_interval('2.5second').as_tuple() == (2.5, SECOND)
示例#2
0
 def test_from_interval(self):
     assert TimeUnit.from_interval('2second').as_tuple() == (2, SECOND)
     assert TimeUnit.from_interval('2.5second').as_tuple() == (2.5, SECOND)
示例#3
0
 def test_from_interval_invalid(self):
     inputs = [None, '', 'minute1', '-1minute', '2meter']
     for i in inputs:
         with pytest.raises(ValueError):
             TimeUnit.from_interval(i)
示例#4
0
 def test_from_interval_invalid(self):
     inputs = [None, '', 'minute1', '-1minute', '2meter']
     for i in inputs:
         with pytest.raises(ValueError):
             TimeUnit.from_interval(i)