File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -541,11 +541,10 @@ def __repr__(self):
541541 return '<%s: %s>' % (self .__class__ .__name__ , _spacejoin (l ))
542542
543543 def js_output (self , attrs = None ):
544- warnings .warn (
545- "http.cookies.BaseCookie.js_output() is deprecated and will "
546- "be removed in Python 3.19; use output() instead" ,
547- DeprecationWarning ,
548- stacklevel = 2 ,
544+ warnings ._deprecated (
545+ "http.cookies.BaseCookie.js_output" ,
546+ remove = (3 , 19 ),
547+ message = "http.cookies.BaseCookie.js_output() is deprecated, use output() instead" ,
549548 )
550549 """Return a string suitable for JavaScript."""
551550 result = []
Original file line number Diff line number Diff line change @@ -676,20 +676,21 @@ def test_control_characters_output(self):
676676 morsel ._key = c0 # Override private variable.
677677 cookie = cookies .SimpleCookie ()
678678 cookie ["cookie" ] = morsel
679- with self .assertWarnsRegex ( DeprecationWarning , r"BaseCookie\.js_output" ):
680- with self .assertRaises ( cookies . CookieError ):
679+ with self .assertRaises ( cookies . CookieError ):
680+ with self .assertWarnsRegex ( DeprecationWarning , r"BaseCookie\.js_output" ):
681681 cookie .js_output ()
682682
683683 morsel = cookies .Morsel ()
684684 morsel .set ("key" , "value" , "coded-value" )
685685 morsel ._coded_value = c0 # Override private variable.
686686 cookie = cookies .SimpleCookie ()
687687 cookie ["cookie" ] = morsel
688- with self .assertWarnsRegex ( DeprecationWarning , r"BaseCookie\.js_output" ):
689- with self .assertRaises ( cookies . CookieError ):
688+ with self .assertRaises ( cookies . CookieError ):
689+ with self .assertWarnsRegex ( DeprecationWarning , r"BaseCookie\.js_output" ):
690690 cookie .js_output ()
691691
692692
693+
693694def load_tests (loader , tests , pattern ):
694695 tests .addTest (doctest .DocTestSuite (cookies ))
695696 return tests
You can’t perform that action at this time.
0 commit comments