#NEWLINE# def test_readline_from_socket( self , monkeypatch ) : #NEWLINE# #INDENT# monkeypatch . setattr ( hyper . common . bufsocket . select , 'select' , dummy_select ) #NEWLINE# s = DummySocket ( ) #NEWLINE# b = BufferedSocket ( two ) #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# for i in range ( 0 , len ( combined ) , 5 ) : #NEWLINE# #INDENT# s . inbound_packets . append ( combined [ i : ( i + 5 ) ] ) #NEWLINE# #UNINDENT# assert ( b . readline ( ) . tobytes ( ) == one ) #NEWLINE# assert ( b . readline ( ) . tobytes ( ) == two ) #NEWLINE# assert ( b . readline ( ) . tobytes ( ) == three )