1- from typing import Any , Dict , List , Union
1+ from __future__ import annotations
2+
3+ from typing import Any
24
35import pytest
46
@@ -20,51 +22,51 @@ def reset_metric_set():
2022
2123
2224@pytest .fixture
23- def metric_with_resolution () -> Dict [str , Union [ str , int ] ]:
25+ def metric_with_resolution () -> dict [str , str | int ]:
2426 return {"name" : "single_metric" , "unit" : MetricUnit .Count , "value" : 1 , "resolution" : MetricResolution .High }
2527
2628
2729@pytest .fixture
28- def metric () -> Dict [str , str ]:
30+ def metric () -> dict [str , str ]:
2931 return {"name" : "single_metric" , "unit" : MetricUnit .Count , "value" : 1 }
3032
3133
3234@pytest .fixture
33- def metric_datadog () -> Dict [str , str ]:
35+ def metric_datadog () -> dict [str , str ]:
3436 return {"name" : "single_metric" , "value" : 1 , "timestamp" : 1691678198 , "powertools" : "datadog" }
3537
3638
3739@pytest .fixture
38- def metrics () -> List [ Dict [str , str ]]:
40+ def metrics () -> list [ dict [str , str ]]:
3941 return [
4042 {"name" : "metric_one" , "unit" : MetricUnit .Count , "value" : 1 },
4143 {"name" : "metric_two" , "unit" : MetricUnit .Count , "value" : 1 },
4244 ]
4345
4446
4547@pytest .fixture
46- def metrics_same_name () -> List [ Dict [str , str ]]:
48+ def metrics_same_name () -> list [ dict [str , str ]]:
4749 return [
4850 {"name" : "metric_one" , "unit" : MetricUnit .Count , "value" : 1 },
4951 {"name" : "metric_one" , "unit" : MetricUnit .Count , "value" : 5 },
5052 ]
5153
5254
5355@pytest .fixture
54- def dimension () -> Dict [str , str ]:
56+ def dimension () -> dict [str , str ]:
5557 return {"name" : "test_dimension" , "value" : "test" }
5658
5759
5860@pytest .fixture
59- def dimensions () -> List [ Dict [str , str ]]:
61+ def dimensions () -> list [ dict [str , str ]]:
6062 return [
6163 {"name" : "test_dimension" , "value" : "test" },
6264 {"name" : "test_dimension_2" , "value" : "test" },
6365 ]
6466
6567
6668@pytest .fixture
67- def non_str_dimensions () -> List [ Dict [str , Any ]]:
69+ def non_str_dimensions () -> list [ dict [str , Any ]]:
6870 return [
6971 {"name" : "test_dimension" , "value" : True },
7072 {"name" : "test_dimension_2" , "value" : 3 },
@@ -82,15 +84,15 @@ def service() -> str:
8284
8385
8486@pytest .fixture
85- def metadata () -> Dict [str , str ]:
87+ def metadata () -> dict [str , str ]:
8688 return {"key" : "username" , "value" : "test" }
8789
8890
8991@pytest .fixture
90- def a_hundred_metrics () -> List [ Dict [str , str ]]:
92+ def a_hundred_metrics () -> list [ dict [str , str ]]:
9193 return [{"name" : f"metric_{ i } " , "unit" : "Count" , "value" : 1 } for i in range (100 )]
9294
9395
9496@pytest .fixture
95- def a_hundred_metric_values () -> List [ Dict [str , str ]]:
97+ def a_hundred_metric_values () -> list [ dict [str , str ]]:
9698 return [{"name" : "metric" , "unit" : "Count" , "value" : i } for i in range (100 )]
0 commit comments