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

Method test_x_mode

Lib/test/test_zstd.py:2604–2621  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2602 self.assertEqual(f.readlines(), [text])
2603
2604 def test_x_mode(self):
2605 with tempfile.NamedTemporaryFile(delete=False) as tmp_f:
2606 TESTFN = pathlib.Path(tmp_f.name)
2607
2608 for mode in ("x", "xb", "xt"):
2609 os.remove(TESTFN)
2610
2611 if mode == "xt":
2612 encoding = "utf-8"
2613 else:
2614 encoding = None
2615 with open(TESTFN, mode, encoding=encoding):
2616 pass
2617 with self.assertRaises(FileExistsError):
2618 with open(TESTFN, mode):
2619 pass
2620
2621 os.remove(TESTFN)
2622
2623 def test_open_dict(self):
2624 # default

Callers

nothing calls this directly

Calls 3

openFunction · 0.90
removeMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected