def test_x_mode(self):
    for mode in ('x', 'xb', 'xt'):
        unlink(self.filename)
        encoding = ('utf-8' if ('t' in mode) else None)
        with self.open(self.filename, mode, encoding=encoding) as f:
            pass
        with self.assertRaises(FileExistsError):
            with self.open(self.filename, mode) as f:
                pass
def test_x_mode(self):
    for mode in ('x', 'xb', 'xt'):
        unlink(self.filename)
        encoding = ('utf-8' if ('t' in mode) else None)
        with self.open(self.filename, mode, encoding=encoding) as f:
            pass
        with self.assertRaises(FileExistsError):
            with self.open(self.filename, mode) as f:
                pass