def test_newline(self):
        """
        When {HistoricRecvLine} receives a newline, it adds the current
        line buffer to the end of its history buffer.
        """
        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'), ()))

        kR(b'c')
        kR(b'b')
        kR(b'a')
        self.assertEqual(self.p.currentHistoryBuffer(),
                          ((b'xyz', b'abc', b'123'), ()))

        kR(b'\n')
        self.assertEqual(self.p.currentHistoryBuffer(),
                          ((b'xyz', b'abc', b'123', b'cba'), ()))

        When {HistoricRecvLine} receives a newline, it adds the current
        line buffer to the end of its history buffer.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/test/test_recvline.py