@@ -81,14 +81,15 @@ async def test_subscribe_unsubscribe():
8181
8282 # We do check that the `thing` and `affordance` are strings, because it would
8383 # be very easy to pass a `Thing` by accident otherwise.
84- with pytest .raises (TypeError ):
85- await broker .subscribe (Unjsonable (), "whatever" , send_stream ) # type: ignore
86- with pytest .raises (TypeError ):
87- await broker .unsubscribe (Unjsonable (), "whatever" , send_stream ) # type: ignore
88- with pytest .raises (TypeError ):
89- await broker .subscribe ("whatever" , Unjsonable (), send_stream ) # type: ignore
90- with pytest .raises (TypeError ):
91- await broker .unsubscribe ("whatever" , Unjsonable (), send_stream ) # type: ignore
84+ msg_suffix = " must be a string, not '42'"
85+ with pytest .raises (TypeError , match = "`thing`" + msg_suffix ):
86+ await broker .subscribe (42 , "whatever" , send_stream ) # type: ignore
87+ with pytest .raises (TypeError , match = "`thing`" + msg_suffix ):
88+ await broker .unsubscribe (42 , "whatever" , send_stream ) # type: ignore
89+ with pytest .raises (TypeError , match = "`affordance`" + msg_suffix ):
90+ await broker .subscribe ("whatever" , 42 , send_stream ) # type: ignore
91+ with pytest .raises (TypeError , match = "`affordance`" + msg_suffix ):
92+ await broker .unsubscribe ("whatever" , 42 , send_stream ) # type: ignore
9293
9394
9495async def append_messages (
0 commit comments