def testWriteNonDefaultCompressLevel(self):
    expected = bz2.compress(self.TEXT, compresslevel=5)
    with BZ2File(self.filename, 'w', compresslevel=5) as bz2f:
        bz2f.write(self.TEXT)
    with open(self.filename, 'rb') as f:
        self.assertEqual(f.read(), expected)
def testWriteNonDefaultCompressLevel(self):
    expected = bz2.compress(self.TEXT, compresslevel=5)
    with BZ2File(self.filename, 'w', compresslevel=5) as bz2f:
        bz2f.write(self.TEXT)
    with open(self.filename, 'rb') as f:
        self.assertEqual(f.read(), expected)