def test_addReader(self):
        """
        Adding a filesystem file reader to a reactor will make sure it is
        polled.
        """
        reactor = self.buildReactor()

        class DataProtocol(Protocol):
            data = b""
            def dataReceived(self, data):
                self.data += data
                # It'd be better to stop reactor on connectionLost, but that
                # fails on FreeBSD, probably due to
                # http://bugs.python.org/issue9591:
                if self.data == b"hello!":
                    reactor.stop()

        path = self.mktemp()

        with open(path, "wb") as f:
            f.write(b"hello!")

        with open(path, "rb") as f:
            # Read bytes from a file, deliver them to a protocol instance:
            protocol = DataProtocol()
            StandardIO(protocol, stdin=f.fileno(),
                       stdout=self.extraFile.fileno(),
                       reactor=reactor)
            self.runReactor(reactor)

        self.assertEqual(protocol.data, b"hello!")

        Adding a filesystem file reader to a reactor will make sure it is
        polled.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_stdio.py