MCPcopy Index your code
hub / github.com/python/cpython / test_x_mode

Method test_x_mode

Lib/test/test_bz2.py:1149–1157  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1147 self.assertEqual(file_data, text_native_eol * 2)
1148
1149 def test_x_mode(self):
1150 for mode in ("x", "xb", "xt"):
1151 unlink(self.filename)
1152 encoding = "utf-8" if "t" in mode else None
1153 with self.open(self.filename, mode, encoding=encoding) as f:
1154 pass
1155 with self.assertRaises(FileExistsError):
1156 with self.open(self.filename, mode) as f:
1157 pass
1158
1159 def test_fileobj(self):
1160 with self.open(BytesIO(self.DATA), "r") as f:

Callers

nothing calls this directly

Calls 3

openMethod · 0.95
unlinkFunction · 0.90
assertRaisesMethod · 0.45

Tested by

no test coverage detected