#NEWLINE# def test_readline_both( self , monkeypatch ) : #NEWLINE# #INDENT# monkeypatch . setattr ( hyper . common . bufsocket . select , 'select' , dummy_select ) #NEWLINE# s = DummySocket ( ) #NEWLINE# b = BufferedSocket ( s ) #NEWLINE# one = b'hi there\r\n' #NEWLINE# two = b'this is another line\r\n' #NEWLINE# three = b'\r\n' #NEWLINE# combined = b'' . join ( [ one , two , three ] ) #NEWLINE# split_index = int ( ( len ( combined ) / 2 ) ) #NEWLINE# b . _buffer_view [ 0 : split_index ] = combined [ 0 : split_index ] #NEWLINE# b . _bytes_in_buffer += split_index #NEWLINE# for i in range ( split_index , len ( combined ) , 5 ) : #NEWLINE# #INDENT# s . inbound_packets . append ( combined [ combined : ( i + 5 ) ] ) #NEWLINE# #UNINDENT# assert ( b . readline ( ) . tobytes ( ) == one ) #NEWLINE# assert ( b . readline ( ) . tobytes ( ) == two ) #NEWLINE# assert ( b . readline ( ) . tobytes ( ) == three )