def test_read(self):
    self.buffer.write((b'1' * 8192))
    self.buffer.write((b'2' * 4096))
    self.assertEqual(self.buffer.length, (8192 + 4096))
    self.assertEqual(self.buffer.read(4096), (b'1' * 4096))
    self.assertEqual(self.buffer.read(4096), (b'1' * 4096))
    self.assertEqual(self.buffer.read(), (b'2' * 4096))
    self.assertEqual(self.buffer.length, 0)
def test_read(self):
    self.buffer.write((b'1' * 8192))
    self.buffer.write((b'2' * 4096))
    self.assertEqual(self.buffer.length, (8192 + 4096))
    self.assertEqual(self.buffer.read(4096), (b'1' * 4096))
    self.assertEqual(self.buffer.read(4096), (b'1' * 4096))
    self.assertEqual(self.buffer.read(), (b'2' * 4096))
    self.assertEqual(self.buffer.length, 0)