def test_implicit_binary_modes(self):
    for mode in ('w', 'x'):
        if (mode == 'x'):
            unlink(self.filename)
        with self.open(self.filename, mode) as f:
            f.write(self.TEXT)
        with open(self.filename, 'rb') as f:
            file_data = ext_decompress(f.read())
            self.assertEqual(file_data, self.TEXT)
        with self.open(self.filename, 'r') as f:
            self.assertEqual(f.read(), self.TEXT)
        with self.open(self.filename, 'a') as f:
            f.write(self.TEXT)
        with open(self.filename, 'rb') as f:
            file_data = ext_decompress(f.read())
            self.assertEqual(file_data, (self.TEXT * 2))
def test_implicit_binary_modes(self):
    for mode in ('w', 'x'):
        if (mode == 'x'):
            unlink(self.filename)
        with self.open(self.filename, mode) as f:
            f.write(self.TEXT)
        with open(self.filename, 'rb') as f:
            file_data = ext_decompress(f.read())
            self.assertEqual(file_data, self.TEXT)
        with self.open(self.filename, 'r') as f:
            self.assertEqual(f.read(), self.TEXT)
        with self.open(self.filename, 'a') as f:
            f.write(self.TEXT)
        with open(self.filename, 'rb') as f:
            file_data = ext_decompress(f.read())
            self.assertEqual(file_data, (self.TEXT * 2))