def test_read_truncated(self):
    truncated = self.DATA[:(- 10)]
    with BZ2File(BytesIO(truncated)) as f:
        self.assertRaises(EOFError, f.read)
    with BZ2File(BytesIO(truncated)) as f:
        self.assertEqual(f.read(len(self.TEXT)), self.TEXT)
        self.assertRaises(EOFError, f.read, 1)
    for i in range(22):
        with BZ2File(BytesIO(truncated[:i])) as f:
            self.assertRaises(EOFError, f.read, 1)
def test_read_truncated(self):
    truncated = self.DATA[:(- 10)]
    with BZ2File(BytesIO(truncated)) as f:
        self.assertRaises(EOFError, f.read)
    with BZ2File(BytesIO(truncated)) as f:
        self.assertEqual(f.read(len(self.TEXT)), self.TEXT)
        self.assertRaises(EOFError, f.read, 1)
    for i in range(22):
        with BZ2File(BytesIO(truncated[:i])) as f:
            self.assertRaises(EOFError, f.read, 1)