@@ -20,16 +20,19 @@ def test_iso_format(self):
2020 self .assertEqual (dt .timestamp (), 1626249617.0 )
2121
2222
23- @pytest .mark .parametrize ('ts,target_type,expected_result' , [
24- (1701209097 , int , 1701209097 ),
25- (datetime (2023 , 11 , 28 , 22 , 9 , 7 , tzinfo = timezone .utc ), int , 1701209347 ),
26- ("1701209605" , int , 1701209605 ),
27- ("2023-11-28 22:11:19" , int , 1701209479 ),
28- (1701209998.3429494 , float , 1701209998.3429494 ),
29- (datetime (2023 , 11 , 28 , 22 , 20 , 25 , 262571 , tzinfo = timezone .utc ), float , 1701210025.262571 ),
30- ("1701210054.4672053" , float , 1701210054.4672053 ),
31- ("2023-11-28 22:21:14.745556" , float , 1701210074.745556 ),
32- ])
23+ @pytest .mark .parametrize (
24+ "ts,target_type,expected_result" ,
25+ [
26+ (1701209097 , int , 1701209097 ),
27+ (datetime (2023 , 11 , 28 , 22 , 9 , 7 , tzinfo = timezone .utc ), int , 1701209347 ),
28+ ("1701209605" , int , 1701209605 ),
29+ ("2023-11-28 22:11:19" , int , 1701209479 ),
30+ (1701209998.3429494 , float , 1701209998.3429494 ),
31+ (datetime (2023 , 11 , 28 , 22 , 20 , 25 , 262571 , tzinfo = timezone .utc ), float , 1701210025.262571 ),
32+ ("1701210054.4672053" , float , 1701210054.4672053 ),
33+ ("2023-11-28 22:21:14.745556" , float , 1701210074.745556 ),
34+ ],
35+ )
3336def test_timestamp_to_type (ts , target_type , expected_result ):
3437 result = _timestamp_to_type (ts , target_type )
3538 assert result == expected_result
@@ -38,7 +41,7 @@ def test_timestamp_to_type(ts, target_type, expected_result):
3841def test_timestamp_to_type_invalid_str ():
3942 match = "Invalid isoformat string" if sys .version_info [:2 ] > (3 , 6 ) else "time data .* does not match format"
4043 with pytest .raises (ValueError , match = match ):
41- _timestamp_to_type (' not-a-timestamp' , int )
44+ _timestamp_to_type (" not-a-timestamp" , int )
4245
4346
4447def test_timestamp_to_type_unsupported_format ():
0 commit comments