Skip to content

Commit 19765e2

Browse files
fix
1 parent ae8ee9d commit 19765e2

File tree

1 file changed

+18
-39
lines changed

1 file changed

+18
-39
lines changed

tests/test_tracing.py

Lines changed: 18 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2609,7 +2609,7 @@ def test_sqs_invalid_datadog_message_attribute(self, mock_logger):
26092609
}
26102610
]
26112611
},
2612-
"expected_log": "The trace extractor returned with error %s",
2612+
"expected_log": ("The trace extractor returned with error %s", ANY),
26132613
},
26142614
{
26152615
"name": "unsupported_datatype",
@@ -2627,8 +2627,10 @@ def test_sqs_invalid_datadog_message_attribute(self, mock_logger):
26272627
}
26282628
]
26292629
},
2630-
"expected_log": "Datadog Lambda Python only supports extracting trace"
2631-
"context from String or Binary SQS/SNS message attributes",
2630+
"expected_log": (
2631+
"Datadog Lambda Python only supports extracting trace"
2632+
"context from String or Binary SQS/SNS message attributes",
2633+
),
26322634
},
26332635
]
26342636

@@ -2644,16 +2646,7 @@ def test_sqs_invalid_datadog_message_attribute(self, mock_logger):
26442646
)
26452647

26462648
# Exception triggers logger
2647-
if (
2648-
test_case["expected_log"]
2649-
== "The trace extractor returned with error %s"
2650-
):
2651-
mock_logger.debug.assert_any_call(
2652-
test_case["expected_log"],
2653-
ANY,
2654-
)
2655-
else:
2656-
mock_logger.debug.assert_any_call(test_case["expected_log"])
2649+
mock_logger.debug.assert_any_call(*test_case["expected_log"])
26572650

26582651
self.assertEqual(self.mock_checkpoint.call_count, 1)
26592652
args, _ = self.mock_checkpoint.call_args
@@ -2860,7 +2853,7 @@ def test_sns_invalid_datadog_message_attribute(self, mock_logger):
28602853
}
28612854
]
28622855
},
2863-
"expected_log": "The trace extractor returned with error %s",
2856+
"expected_log": ("The trace extractor returned with error %s", ANY),
28642857
},
28652858
{
28662859
"name": "unsupported_datatype",
@@ -2880,8 +2873,10 @@ def test_sns_invalid_datadog_message_attribute(self, mock_logger):
28802873
}
28812874
]
28822875
},
2883-
"expected_log": "Datadog Lambda Python only supports extracting trace"
2884-
"context from String or Binary SQS/SNS message attributes",
2876+
"expected_log": (
2877+
"Datadog Lambda Python only supports extracting trace"
2878+
"context from String or Binary SQS/SNS message attributes",
2879+
),
28852880
},
28862881
]
28872882

@@ -2897,16 +2892,7 @@ def test_sns_invalid_datadog_message_attribute(self, mock_logger):
28972892
)
28982893

28992894
# Exception triggers logger
2900-
if (
2901-
test_case["expected_log"]
2902-
== "The trace extractor returned with error %s"
2903-
):
2904-
mock_logger.debug.assert_any_call(
2905-
test_case["expected_log"],
2906-
ANY,
2907-
)
2908-
else:
2909-
mock_logger.debug.assert_any_call(test_case["expected_log"])
2895+
mock_logger.debug.assert_any_call(*test_case["expected_log"])
29102896

29112897
self.assertEqual(self.mock_checkpoint.call_count, 1)
29122898
args, _ = self.mock_checkpoint.call_args
@@ -3135,7 +3121,7 @@ def test_sns_to_sqs_invalid_datadog_message_attribute(self, mock_logger):
31353121
},
31363122
"Message": "test message",
31373123
},
3138-
"expected_log": "The trace extractor returned with error %s",
3124+
"expected_log": ("The trace extractor returned with error %s", ANY),
31393125
},
31403126
{
31413127
"name": "unsupported_datatype",
@@ -3150,8 +3136,10 @@ def test_sns_to_sqs_invalid_datadog_message_attribute(self, mock_logger):
31503136
},
31513137
"Message": "test message",
31523138
},
3153-
"expected_log": "Datadog Lambda Python only supports extracting trace"
3154-
"context from String or Binary SQS/SNS message attributes",
3139+
"expected_log": (
3140+
"Datadog Lambda Python only supports extracting trace"
3141+
"context from String or Binary SQS/SNS message attributes",
3142+
),
31553143
},
31563144
]
31573145

@@ -3175,16 +3163,7 @@ def test_sns_to_sqs_invalid_datadog_message_attribute(self, mock_logger):
31753163
)
31763164

31773165
# Exception triggers logger
3178-
if (
3179-
test_case["expected_log"]
3180-
== "The trace extractor returned with error %s"
3181-
):
3182-
mock_logger.debug.assert_any_call(
3183-
test_case["expected_log"],
3184-
ANY,
3185-
)
3186-
else:
3187-
mock_logger.debug.assert_any_call(test_case["expected_log"])
3166+
mock_logger.debug.assert_any_call(*test_case["expected_log"])
31883167

31893168
self.assertEqual(self.mock_checkpoint.call_count, 1)
31903169
args, _ = self.mock_checkpoint.call_args

0 commit comments

Comments
 (0)