Coverage for test/test_timestamp_processor.py: 100%

19 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2025-04-12 17:57 +0000

1import pytest 

2from datetime import datetime 

3from annotation.timestamp_processor import TimestampProcessor 

4 

5 

6class TestTimestampProcessor: 

7 

8 def test_init(self): 

9 test_timestamp = TimestampProcessor('2014-09-05T14:08:41Z') 

10 assert test_timestamp.timestamp == datetime(2014, 9, 5, 14, 8, 41) 

11 

12 def test_init_round_down(self): 

13 test_timestamp = TimestampProcessor('2014-09-05T14:08:41.492Z') 

14 assert test_timestamp.timestamp == datetime(2014, 9, 5, 14, 8, 41) 

15 

16 def test_init_round_up(self): 

17 test_timestamp = TimestampProcessor('2014-09-05T14:08:41.592Z') 

18 assert test_timestamp.timestamp == datetime(2014, 9, 5, 14, 8, 42) 

19 

20 def test_init_fail(self): 

21 with pytest.raises(Exception): 

22 TimestampProcessor('not a timestamp') 

23 

24 def test_get_formatted_timestamp(self): 

25 test_timestamp = TimestampProcessor('2014-09-05T14:08:41Z') 

26 assert test_timestamp.get_formatted_timestamp() == '14:08:41'