<s> import unittest <EOL> import warnings <EOL> from iktomi . utils . deprecation import deprecated <EOL> __all__ = [ '<STR_LIT>' ] <EOL> class DeprecationTests ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . old_filters = warnings . filters [ : ] <EOL> warnings . simplefilter ( '<STR_LIT>' ) <EOL> def tearDown ( self ) : <EOL> warnings . filters [ : ] = self . old_filters <EOL> def test_deprecated_simple ( self ) : <EOL> @ deprecated ( ) <EOL> def f ( arg ) : <EOL> return arg <EOL> ARG = object ( ) <EOL> with warnings . catch_warnings ( record = True ) as recorded : <EOL> returned = f ( ARG ) <EOL> self . assertIs ( returned , ARG ) <EOL> self . assertEqual ( len ( recorded ) , <NUM_LIT:1> ) <EOL> def test_deprecated_comment ( self ) : <EOL> COMMENT = '<STR_LIT>' <EOL> @ deprecated ( comment = COMMENT ) <EOL> def f ( arg ) : <EOL> return arg <EOL> ARG = object ( ) <EOL> with warnings . catch_warnings ( record = True ) as recorded : <EOL> returned = f ( ARG ) <EOL> self . assertIs ( returned , ARG ) <EOL> self . assertEqual ( len ( recorded ) , <NUM_LIT:1> ) <EOL> self . assertIn ( COMMENT , str ( recorded [ - <NUM_LIT:1> ] . message ) ) </s>
