From a3c563e1045407bd72b9c4ac3925011749c8bfa9 Mon Sep 17 00:00:00 2001 From: Christopher Broderick Date: Sat, 10 May 2025 13:16:35 +0100 Subject: [PATCH] Optimise check --- helpdesk/tests/test_ticket_submission.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/helpdesk/tests/test_ticket_submission.py b/helpdesk/tests/test_ticket_submission.py index e2e5b3a2..e86691b1 100644 --- a/helpdesk/tests/test_ticket_submission.py +++ b/helpdesk/tests/test_ticket_submission.py @@ -511,13 +511,9 @@ class EmailInteractionsTestCase(TestCase): ) # Check that the CC duplicate was still sent a notification email email_count = len(mail.outbox) - found = False - for i in range(0, email_count - 1): - if dup_email in mail.outbox[i].to: - found = True - break + found = any(dup_email in email.to for email in mail.outbox[:email_count - 1]) self.assertTrue( - found, "The duplicated email across user ID's was not sent a n otification." + found, "The duplicated email across user ID's was not sent a notification." ) def test_create_followup_from_email_with_valid_message_id_with_no_initial_cc_list(