#NEWLINE# def test_read_size( ) : #NEWLINE# #INDENT# conn = _get_test_conn ( ) #NEWLINE# body_size = 6 #NEWLINE# body_size_packed = struct . pack ( '>l' , body_size ) #NEWLINE# conn . _read_size ( body_size_packed ) #NEWLINE# conn . stream . read_bytes . assert_called_once_with ( body_size , conn . _read_body ) #NEWLINE# conn . stream . read_bytes . reset_mock ( ) #NEWLINE# with patch . object ( conn , 'close' , autospec = True ) as mock_close : #NEWLINE# #INDENT# conn . _read_size ( 'asdfasdf' ) #NEWLINE# mock_close . assert_called_once_with ( ) #NEWLINE# assert ( not conn . stream . read_bytes . called )