@@ -73,10 +73,10 @@ def manage_context(self):
7373 if self .exception_type is not type (exception ):
7474 assert issubclass (type (exception ), self .exception_type )
7575 raise Failure (
76- "The exception `%s` was raised, and it *is* an "
77- "instance of the `%s` we were expecting; but its type "
78- "is not `%s` , it's `%s` , which is a subclass of `%s` , "
79- "but you specified `assert_exact_type=True`, so "
76+ "The exception %s was raised, and it *is* an "
77+ "instance of the %s we were expecting; but its type "
78+ "is not %s , it's %s , which is a subclass of %s , "
79+ "and you specified `assert_exact_type=True`, so "
8080 "subclasses aren't acceptable." % (repr (exception ),
8181 self .exception_type .__name__ ,
8282 self .exception_type .__name__ , type (exception ).__name__ ,
@@ -87,24 +87,24 @@ def manage_context(self):
8787 if isinstance (self .text , str ):
8888 if self .text not in message :
8989 raise Failure (
90- "A `%s` was raised but %s wasn't in its message." %
91- ( self . exception_type . __name__ , repr (self .text ))
90+ f "A { self . exception_type . __name__ } was raised "
91+ f"but { repr (self .text )} wasn't in its message."
9292 )
9393 else :
9494 # It's a regex pattern
9595 if not self .text .match (message ):
9696 raise Failure (
97- "A `%s` was raised but it didn't match the given "
98- "regex." % self . exception_type . __name__
97+ f "A { self . exception_type . __name__ } was raised "
98+ f"but it didn't match the given regex."
9999 )
100100 except BaseException as different_exception :
101101 raise Failure (
102- "%s was excpected, but a different exception %s was raised "
103- "instead." % ( self . exception_type . __name__ ,
104- type ( different_exception ). __name__ )
102+ f" { self . exception_type . __name__ } was excpected, but a "
103+ f"different exception { type ( different_exception ). __name__ } "
104+ f"was raised instead."
105105 )
106106 else :
107- raise Failure ("%s wasn't raised." % self . exception_type . __name__ )
107+ raise Failure (f" { self . exception_type . __name__ } wasn't raised." )
108108
109109
110110def assert_same_signature (* callables ):
0 commit comments