MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_x_mode

Method test_x_mode

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

openFunction · 0.90
removeMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected