(self)
| 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 |
nothing calls this directly
no test coverage detected