#NEWLINE# def test_send_msg( self ) : #NEWLINE# #INDENT# msg_dict = { #NEWLINE# #INDENT# 'hello' : 'world' , #NEWLINE# #UNINDENT# } #NEWLINE# expected_output = msgpack . packb ( msg_dict ) #NEWLINE# with mock . patch . object ( self . instance , '_output_stream' , BytesIO ( ) ) as sio : #NEWLINE# #INDENT# self . instance . send_msg ( msg_dict ) #NEWLINE# #UNINDENT# assert ( sio . getvalue ( ) == expected_output )