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