def test_illegal(self):
        """
        Assert that illegal strings cause the transport to be closed.
        """
        for s in self.illegalStrings:
            r = self.getProtocol()
            for c in iterbytes(s):
                r.dataReceived(c)
            self.assertTrue(r.transport.disconnecting)

        Assert that illegal strings cause the transport to be closed.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/test/test_basic.py