#NEWLINE# def test_addReader( self ) : #NEWLINE# #INDENT# '\n        Adding a filesystem file reader to a reactor will make sure it is\n        polled.\n        ' #NEWLINE# reactor = self . buildReactor ( ) #NEWLINE# class DataProtocol ( Protocol ) : #NEWLINE# #INDENT# data = b'' #NEWLINE# def dataReceived( self , data ) : #NEWLINE# #INDENT# self . data += data #NEWLINE# if ( self . data == b'hello!' ) : #NEWLINE# #INDENT# reactor . stop ( ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# path = self . mktemp ( ) #NEWLINE# with open ( path , 'wb' ) as f : #NEWLINE# #INDENT# f . write ( b'hello!' ) #NEWLINE# #UNINDENT# with open ( path , 'rb' ) as f : #NEWLINE# #INDENT# protocol = DataProtocol ( ) #NEWLINE# StandardIO ( protocol , stdin = f . fileno ( ) , stdout = self . extraFile . fileno ( ) , reactor = reactor ) #NEWLINE# self . runReactor ( reactor ) #NEWLINE# #UNINDENT# self . assertEqual ( protocol . data , b'hello!' )