def testAppend(self):
    with BZ2File(self.filename, 'w') as bz2f:
        self.assertRaises(TypeError, bz2f.write)
        bz2f.write(self.TEXT)
    with BZ2File(self.filename, 'a') as bz2f:
        self.assertRaises(TypeError, bz2f.write)
        bz2f.write(self.TEXT)
    with open(self.filename, 'rb') as f:
        self.assertEqual(ext_decompress(f.read()), (self.TEXT * 2))
def testAppend(self):
    with BZ2File(self.filename, 'w') as bz2f:
        self.assertRaises(TypeError, bz2f.write)
        bz2f.write(self.TEXT)
    with BZ2File(self.filename, 'a') as bz2f:
        self.assertRaises(TypeError, bz2f.write)
        bz2f.write(self.TEXT)
    with open(self.filename, 'rb') as f:
        self.assertEqual(ext_decompress(f.read()), (self.TEXT * 2))