File tree Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ def __init__(
4949 self .exception = exception
5050 self .content_type = content_type
5151 if reason :
52- self .reason_phrase = f" { self . status_text } ({ reason } )"
52+ self .reason_phrase = "{ } ({})". format ( self . status_text , reason )
5353
5454 if headers :
5555 for name , value in headers .items ():
Original file line number Diff line number Diff line change @@ -297,7 +297,7 @@ def test_form_has_label_and_help_text(self):
297297class ReasonPhraseTests (TestCase ):
298298 def test_reason_is_set (self ):
299299 resp = self .client .get ('/with_reason' )
300- self .assertEqual (f "OK ({ DUMMYREASON } )" , resp .reason_phrase )
300+ self .assertEqual ("OK ({})" . format ( DUMMYREASON ) , resp .reason_phrase )
301301
302302 def test_reason_phrase_with_no_reason (self ):
303303 resp = self .client .get ('/' )
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ def test_400_validation_error(self):
9999 request = factory .get ('/' )
100100 response = ValidationErrorView .as_view ()(request )
101101 assert response .status_code == status .HTTP_400_BAD_REQUEST
102- assert response .reason_phrase == f" { STATUS_CODE_400 } ({ VALIDATION_ERROR } )"
102+ assert response .reason_phrase == "{ } ({})". format ( STATUS_CODE_400 , VALIDATION_ERROR )
103103 assert response .data == [VALIDATION_ERROR ]
104104
105105
@@ -119,7 +119,7 @@ def test_400_validation_error(self):
119119 request = factory .get ('/' )
120120 response = validation_error_view (request )
121121 assert response .status_code == status .HTTP_400_BAD_REQUEST
122- assert response .reason_phrase == f" { STATUS_CODE_400 } ({ VALIDATION_ERROR } )"
122+ assert response .reason_phrase == "{ } ({})". format ( STATUS_CODE_400 , VALIDATION_ERROR )
123123 assert response .data == [VALIDATION_ERROR ]
124124
125125
You can’t perform that action at this time.
0 commit comments