def testReadable(self):
    bz2f = BZ2File(BytesIO(self.DATA))
    try:
        self.assertTrue(bz2f.readable())
        bz2f.read()
        self.assertTrue(bz2f.readable())
    finally:
        bz2f.close()
    self.assertRaises(ValueError, bz2f.readable)
    bz2f = BZ2File(BytesIO(), 'w')
    try:
        self.assertFalse(bz2f.readable())
    finally:
        bz2f.close()
    self.assertRaises(ValueError, bz2f.readable)
def testReadable(self):
    bz2f = BZ2File(BytesIO(self.DATA))
    try:
        self.assertTrue(bz2f.readable())
        bz2f.read()
        self.assertTrue(bz2f.readable())
    finally:
        bz2f.close()
    self.assertRaises(ValueError, bz2f.readable)
    bz2f = BZ2File(BytesIO(), 'w')
    try:
        self.assertFalse(bz2f.readable())
    finally:
        bz2f.close()
    self.assertRaises(ValueError, bz2f.readable)