def test_buffer(self):
        """
        Test buffering over line protocol: data received should match buffer.
        """
        t = proto_helpers.StringTransport()
        a = LineOnlyTester()
        a.makeConnection(t)
        for c in iterbytes(self.buffer):
            a.dataReceived(c)
        self.assertEqual(a.received, self.buffer.split(b'\n')[:-1])

        Test buffering over line protocol: data received should match buffer.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/test/test_basic.py