@@ -260,8 +260,8 @@ async def test_command(self, parser_mock):
260260 ctx = MockContext ()
261261 parser_mock .return_value = (ctx .channel , 10 )
262262
263- for case in test_cases :
264- with self .subTest ("Test command converters" , args = case ):
263+ for i , case in enumerate ( test_cases ) :
264+ with self .subTest (msg = "Test command converters" , test_case = i ):
265265 await cog .silence .callback (cog , ctx , * case )
266266
267267 try :
@@ -433,10 +433,10 @@ async def test_sent_correct_message(self):
433433
434434 targets = (MockTextChannel (), MockVoiceChannel (), None )
435435
436- for ( duration , message , was_silenced ), target in itertools .product (test_cases , targets ):
436+ for i , (( duration , message , was_silenced ), target ) in enumerate ( itertools .product (test_cases , targets ) ):
437437 with (
438438 mock .patch .object (self .cog , "_set_silence_overwrites" , return_value = was_silenced ),
439- self .subTest (was_silenced = was_silenced , target = target , message = message ),
439+ self .subTest (test_case = i , was_silenced = was_silenced , has_target = target is not None ),
440440 mock .patch .object (self .cog , "send_message" ) as send_message
441441 ):
442442 ctx = MockContext ()
@@ -525,8 +525,8 @@ async def test_skipped_already_silenced(self):
525525 (True , MockVoiceChannel (), PermissionOverwrite (connect = False , speak = False )),
526526 )
527527
528- for contains , channel , overwrite in subtests :
529- with self .subTest (contains = contains , is_text = isinstance (channel , MockTextChannel ), overwrite = overwrite ):
528+ for i , ( contains , channel , overwrite ) in enumerate ( subtests ) :
529+ with self .subTest (test_case = i , contains = contains , is_text = isinstance (channel , MockTextChannel )):
530530 self .cog .scheduler .__contains__ .return_value = contains
531531 channel .overwrites_for .return_value = overwrite
532532
@@ -702,7 +702,7 @@ async def test_sent_correct_message(self):
702702
703703 targets = (None , MockTextChannel ())
704704
705- for ( was_unsilenced , message , overwrite ), target in itertools .product (test_cases , targets ):
705+ for i , (( was_unsilenced , message , overwrite ), target ) in enumerate ( itertools .product (test_cases , targets ) ):
706706 ctx = MockContext ()
707707 ctx .channel .overwrites_for .return_value = overwrite
708708 if target :
@@ -711,7 +711,7 @@ async def test_sent_correct_message(self):
711711 with (
712712 mock .patch .object (self .cog , "_unsilence" , return_value = was_unsilenced ),
713713 mock .patch .object (self .cog , "send_message" ) as send_message ,
714- self .subTest (was_unsilenced = was_unsilenced , overwrite = overwrite , target = target ),
714+ self .subTest (test_case = i , was_unsilenced = was_unsilenced , has_target = target is not None ),
715715 ):
716716 await self .cog .unsilence .callback (self .cog , ctx , channel = target )
717717
@@ -722,8 +722,8 @@ async def test_skipped_already_unsilenced(self):
722722 """Permissions were not set and `False` was returned for an already unsilenced channel."""
723723 self .cog .scheduler .__contains__ .return_value = False
724724
725- for channel in ( MockVoiceChannel (), MockTextChannel ()):
726- with self .subTest (channel = channel ):
725+ for i , channel in enumerate (( MockVoiceChannel (), MockTextChannel () )):
726+ with self .subTest (test_case = i ):
727727 self .assertFalse (await self .cog ._unsilence (channel ))
728728 channel .set_permissions .assert_not_called ()
729729
@@ -811,8 +811,8 @@ async def test_cancelled_task(self):
811811
812812 async def test_preserved_other_overwrites_text (self ):
813813 """Text channel's other unrelated overwrites were not changed, including cache misses."""
814- for overwrite_json in ( '{"send_messages": true, "add_reactions": null}' , None ):
815- with self .subTest (overwrite_json = overwrite_json ):
814+ for i , overwrite_json in enumerate (( '{"send_messages": true, "add_reactions": null}' , None ) ):
815+ with self .subTest (test_case = i , has_overwrite = overwrite_json is not None ):
816816 if overwrite_json is None :
817817 await self .cog .previous_overwrites .delete (self .text_channel .id )
818818 else :
@@ -832,8 +832,8 @@ async def test_preserved_other_overwrites_text(self):
832832
833833 async def test_preserved_other_overwrites_voice (self ):
834834 """Voice channel's other unrelated overwrites were not changed, including cache misses."""
835- for overwrite_json in ( '{"connect": true, "speak": true}' , None ):
836- with self .subTest (overwrite_json = overwrite_json ):
835+ for i , overwrite_json in enumerate (( '{"connect": true, "speak": true}' , None ) ):
836+ with self .subTest (test_case = i , has_overwrite = overwrite_json is not None ):
837837 if overwrite_json is None :
838838 await self .cog .previous_overwrites .delete (self .voice_channel .id )
839839 else :
@@ -858,8 +858,8 @@ async def test_unsilence_role(self):
858858 (MockVoiceChannel (), self .cog .bot .get_guild (Guild .id ).get_role (Roles .voice_verified ))
859859 )
860860
861- for channel , role in test_cases :
862- with self .subTest (channel = channel , role = role ):
861+ for i , ( channel , role ) in enumerate ( test_cases ) :
862+ with self .subTest (test_case = i ):
863863 await self .cog ._unsilence_wrapper (channel , MockContext ())
864864 channel .overwrites_for .assert_called_with (role )
865865
0 commit comments