1
- from typing import Any , Dict , List , Union
1
+ from __future__ import annotations
2
+
3
+ from typing import Any
2
4
3
5
import pytest
4
6
@@ -20,51 +22,51 @@ def reset_metric_set():
20
22
21
23
22
24
@pytest .fixture
23
- def metric_with_resolution () -> Dict [str , Union [ str , int ] ]:
25
+ def metric_with_resolution () -> dict [str , str | int ]:
24
26
return {"name" : "single_metric" , "unit" : MetricUnit .Count , "value" : 1 , "resolution" : MetricResolution .High }
25
27
26
28
27
29
@pytest .fixture
28
- def metric () -> Dict [str , str ]:
30
+ def metric () -> dict [str , str ]:
29
31
return {"name" : "single_metric" , "unit" : MetricUnit .Count , "value" : 1 }
30
32
31
33
32
34
@pytest .fixture
33
- def metric_datadog () -> Dict [str , str ]:
35
+ def metric_datadog () -> dict [str , str ]:
34
36
return {"name" : "single_metric" , "value" : 1 , "timestamp" : 1691678198 , "powertools" : "datadog" }
35
37
36
38
37
39
@pytest .fixture
38
- def metrics () -> List [ Dict [str , str ]]:
40
+ def metrics () -> list [ dict [str , str ]]:
39
41
return [
40
42
{"name" : "metric_one" , "unit" : MetricUnit .Count , "value" : 1 },
41
43
{"name" : "metric_two" , "unit" : MetricUnit .Count , "value" : 1 },
42
44
]
43
45
44
46
45
47
@pytest .fixture
46
- def metrics_same_name () -> List [ Dict [str , str ]]:
48
+ def metrics_same_name () -> list [ dict [str , str ]]:
47
49
return [
48
50
{"name" : "metric_one" , "unit" : MetricUnit .Count , "value" : 1 },
49
51
{"name" : "metric_one" , "unit" : MetricUnit .Count , "value" : 5 },
50
52
]
51
53
52
54
53
55
@pytest .fixture
54
- def dimension () -> Dict [str , str ]:
56
+ def dimension () -> dict [str , str ]:
55
57
return {"name" : "test_dimension" , "value" : "test" }
56
58
57
59
58
60
@pytest .fixture
59
- def dimensions () -> List [ Dict [str , str ]]:
61
+ def dimensions () -> list [ dict [str , str ]]:
60
62
return [
61
63
{"name" : "test_dimension" , "value" : "test" },
62
64
{"name" : "test_dimension_2" , "value" : "test" },
63
65
]
64
66
65
67
66
68
@pytest .fixture
67
- def non_str_dimensions () -> List [ Dict [str , Any ]]:
69
+ def non_str_dimensions () -> list [ dict [str , Any ]]:
68
70
return [
69
71
{"name" : "test_dimension" , "value" : True },
70
72
{"name" : "test_dimension_2" , "value" : 3 },
@@ -82,15 +84,15 @@ def service() -> str:
82
84
83
85
84
86
@pytest .fixture
85
- def metadata () -> Dict [str , str ]:
87
+ def metadata () -> dict [str , str ]:
86
88
return {"key" : "username" , "value" : "test" }
87
89
88
90
89
91
@pytest .fixture
90
- def a_hundred_metrics () -> List [ Dict [str , str ]]:
92
+ def a_hundred_metrics () -> list [ dict [str , str ]]:
91
93
return [{"name" : f"metric_{ i } " , "unit" : "Count" , "value" : 1 } for i in range (100 )]
92
94
93
95
94
96
@pytest .fixture
95
- def a_hundred_metric_values () -> List [ Dict [str , str ]]:
97
+ def a_hundred_metric_values () -> list [ dict [str , str ]]:
96
98
return [{"name" : "metric" , "unit" : "Count" , "value" : i } for i in range (100 )]
0 commit comments