def testPeek(self):
    self.createTempFile()
    with BZ2File(self.filename) as bz2f:
        pdata = bz2f.peek()
        self.assertNotEqual(len(pdata), 0)
        self.assertTrue(self.TEXT.startswith(pdata))
        self.assertEqual(bz2f.read(), self.TEXT)
def testPeek(self):
    self.createTempFile()
    with BZ2File(self.filename) as bz2f:
        pdata = bz2f.peek()
        self.assertNotEqual(len(pdata), 0)
        self.assertTrue(self.TEXT.startswith(pdata))
        self.assertEqual(bz2f.read(), self.TEXT)