def test_insert(self):
        """
        When not in INSERT mode, L{HistoricRecvLine} inserts the typed
        character at the cursor before the next character.
        """
        kR = lambda ch: self.p.keystrokeReceived(ch, None)

        for ch in iterbytes(b'xyz'):
            kR(ch)

        kR(self.pt.LEFT_ARROW)
        kR(b'A')
        self.assertEqual(self.p.currentLineBuffer(), (b'xyA', b'z'))

        kR(self.pt.LEFT_ARROW)
        kR(b'B')
        self.assertEqual(self.p.currentLineBuffer(), (b'xyB', b'Az'))

        When not in INSERT mode, L{HistoricRecvLine} inserts the typed
        character at the cursor before the next character.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/test/test_recvline.py