def test_verticalArrows(self):
        """
        When L{HistoricRecvLine} receives UP_ARROW or DOWN_ARROW
        keystrokes it move the current index in the current history
        buffer up or down, and resets the current line buffer to the
        previous or next line in history, respectively for each.
        """
        kR = lambda ch: self.p.keystrokeReceived(ch, None)

        for ch in iterbytes(b'xyz\nabc\n123\n'):
            kR(ch)

        self.assertEqual(self.p.currentHistoryBuffer(),
                          ((b'xyz', b'abc', b'123'), ()))
        self.assertEqual(self.p.currentLineBuffer(), (b'', b''))

        kR(self.pt.UP_ARROW)
        self.assertEqual(self.p.currentHistoryBuffer(),
                          ((b'xyz', b'abc'), (b'123',)))
        self.assertEqual(self.p.currentLineBuffer(), (b'123', b''))

        kR(self.pt.UP_ARROW)
        self.assertEqual(self.p.currentHistoryBuffer(),
                          ((b'xyz',), (b'abc', b'123')))
        self.assertEqual(self.p.currentLineBuffer(), (b'abc', b''))

        kR(self.pt.UP_ARROW)
        self.assertEqual(self.p.currentHistoryBuffer(),
                          ((), (b'xyz', b'abc', b'123')))
        self.assertEqual(self.p.currentLineBuffer(), (b'xyz', b''))

        kR(self.pt.UP_ARROW)
        self.assertEqual(self.p.currentHistoryBuffer(),
                          ((), (b'xyz', b'abc', b'123')))
        self.assertEqual(self.p.currentLineBuffer(), (b'xyz', b''))

        for i in range(4):
            kR(self.pt.DOWN_ARROW)
        self.assertEqual(self.p.currentHistoryBuffer(),
                          ((b'xyz', b'abc', b'123'), ()))

        When L{HistoricRecvLine} receives UP_ARROW or DOWN_ARROW
        keystrokes it move the current index in the current history
        buffer up or down, and resets the current line buffer to the
        previous or next line in history, respectively for each.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/test/test_recvline.py