@mock_streams('stderr')
@with_patched_object(output, 'warnings', True)
def test_warn():
 warn('Test')
 eq_('\nWarning: Test\n\n', sys.stderr.getvalue())

@ mock_streams ( 'stderr' ) @ with_patched_object ( output , 'warnings' , True ) def test_warn ( ) : warn ( 'Test' ) eq_ ( '\nWarning: Test\n\n' , sys . stderr . getvalue ( ) )
warn() should print warning plus given text .