@@ -896,17 +896,17 @@ async def test_user_agent_synthetic_bot_detection(self):
896
896
]
897
897
898
898
# Test each user agent case separately to avoid span accumulation
899
- for i , user_agent in enumerate ( test_cases ) :
899
+ for user_agent in test_cases :
900
900
with self .subTest (user_agent = user_agent ):
901
901
# Clear headers first
902
902
self .scope ["headers" ] = []
903
903
904
- def update_expected_synthetic_bot (expected ):
904
+ def update_expected_synthetic_bot (
905
+ expected , ua : bytes = user_agent
906
+ ):
905
907
expected [3 ]["attributes" ].update (
906
908
{
907
- SpanAttributes .HTTP_USER_AGENT : user_agent .decode (
908
- "utf8"
909
- ),
909
+ SpanAttributes .HTTP_USER_AGENT : ua .decode ("utf8" ),
910
910
USER_AGENT_SYNTHETIC_TYPE : "bot" ,
911
911
}
912
912
)
@@ -933,17 +933,17 @@ async def test_user_agent_synthetic_test_detection(self):
933
933
]
934
934
935
935
# Test each user agent case separately to avoid span accumulation
936
- for i , user_agent in enumerate ( test_cases ) :
936
+ for user_agent in test_cases :
937
937
with self .subTest (user_agent = user_agent ):
938
938
# Clear headers first
939
939
self .scope ["headers" ] = []
940
940
941
- def update_expected_synthetic_test (expected ):
941
+ def update_expected_synthetic_test (
942
+ expected , ua : bytes = user_agent
943
+ ):
942
944
expected [3 ]["attributes" ].update (
943
945
{
944
- SpanAttributes .HTTP_USER_AGENT : user_agent .decode (
945
- "utf8"
946
- ),
946
+ SpanAttributes .HTTP_USER_AGENT : ua .decode ("utf8" ),
947
947
USER_AGENT_SYNTHETIC_TYPE : "test" ,
948
948
}
949
949
)
@@ -971,18 +971,18 @@ async def test_user_agent_non_synthetic(self):
971
971
]
972
972
973
973
# Test each user agent case separately to avoid span accumulation
974
- for i , user_agent in enumerate ( test_cases ) :
974
+ for user_agent in test_cases :
975
975
with self .subTest (user_agent = user_agent ):
976
976
# Clear headers first
977
977
self .scope ["headers" ] = []
978
978
979
- def update_expected_non_synthetic (expected ):
979
+ def update_expected_non_synthetic (
980
+ expected , ua : bytes = user_agent
981
+ ):
980
982
# Should only have the user agent, not synthetic type
981
983
expected [3 ]["attributes" ].update (
982
984
{
983
- SpanAttributes .HTTP_USER_AGENT : user_agent .decode (
984
- "utf8"
985
- ),
985
+ SpanAttributes .HTTP_USER_AGENT : ua .decode ("utf8" ),
986
986
}
987
987
)
988
988
return expected
0 commit comments