Skip to content

Commit 42bf755

Browse files
refactor: improve test descriptions and assertion messages in TestGroupingBugFix
* Revised comments and docstrings for clarity and conciseness. * Enhanced assertion messages to provide better context during test failures. * Adjusted message content in assertions for improved readability.
1 parent 72f191f commit 42bf755

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

tests/test_grouping.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,12 @@ def test_cross_space_grouping_bug_is_fixed(self) -> None:
192192
# Bob participates in both spaces, so he should appear in both
193193
for conversation in other_conversations:
194194
participant_names = {p.display_name for p in conversation.participants}
195-
# Bob should be in the other space conversation since he sent a message there
195+
# Bob should be in the other space since he sent a message there
196196
self.assertIn(
197197
"Bob Johnson",
198198
participant_names,
199-
f"Other space conversation should contain Bob Johnson: {participant_names}",
199+
f"Other space conversation should contain Bob Johnson: "
200+
f"{participant_names}",
200201
)
201202

202203
def test_single_space_grouping_still_works(self) -> None:
@@ -235,7 +236,7 @@ def test_single_space_grouping_still_works(self) -> None:
235236
self.assertEqual(conversation.space_type, SpaceType.GROUP)
236237

237238
def test_non_participant_conversation_leak_bug(self) -> None:
238-
"""Test that conversations are not created when authenticated user is not a participant.
239+
"""Test conversations are not created when user is not a participant.
239240
240241
This test reproduces the bug where conversations are displayed even when
241242
the authenticated user (Bob Johnson) is not one of the participants.
@@ -267,7 +268,7 @@ def test_non_participant_conversation_leak_bug(self) -> None:
267268
sender=user_g,
268269
recipients=[],
269270
timestamp=datetime(2025, 8, 6, 12, 0, 55),
270-
content="this was great! Big thanks to everyone who helped guide us through. 🩷",
271+
content="this was great! Big thanks to everyone who helped guide us.",
271272
),
272273
]
273274

@@ -294,17 +295,17 @@ def test_non_participant_conversation_leak_bug(self) -> None:
294295
self.assertEqual(
295296
len(external_conversations),
296297
0,
297-
f"Should not create conversations where authenticated user is not a participant. "
298+
"Should not create conversations where user is not a participant. "
298299
f"Found {len(external_conversations)} conversations in External space "
299-
f"where Bob Johnson is not a participant.",
300+
"where Bob Johnson is not a participant.",
300301
)
301302

302-
# Verify that conversations are still created for spaces where Bob IS a participant
303+
# Verify conversations are still created for spaces where Bob IS a participant
303304
askcx_conversations = [c for c in conversations if c.space_id == "space_askcx"]
304305
self.assertGreater(
305306
len(askcx_conversations),
306307
0,
307-
"Should still create conversations where authenticated user IS a participant",
308+
"Should still create conversations where authenticated user participates",
308309
)
309310

310311

0 commit comments

Comments
 (0)