def test_escapeAfterApplicationData(self):
        """
        Application data bytes followed by an escape character are passed to a
        call to C{write} before the terminal's handler method for the escape is
        called.
        """
        # Test a short escape
        self._applicationDataTest(
            b'ab\x1bD', [
                ("write", (b"ab",)),
                ("index",)])

        # And a long escape
        self._applicationDataTest(
            b'ab\x1b[4h', [
                ("write", (b"ab",)),
                ("setModes", ([4],))])

        # There's some other cases too, but they're all handled by the same
        # codepaths as above.

        Application data bytes followed by an escape character are passed to a
        call to C{write} before the terminal's handler method for the escape is
        called.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/test/test_insults.py