(self)
| 777 | encoding="utf-8", closefd=False) |
| 778 | |
| 779 | def test_read_closed(self): |
| 780 | with self.open(os_helper.TESTFN, "w", encoding="utf-8") as f: |
| 781 | f.write("egg\n") |
| 782 | with self.open(os_helper.TESTFN, "r", encoding="utf-8") as f: |
| 783 | file = self.open(f.fileno(), "r", encoding="utf-8", closefd=False) |
| 784 | self.assertEqual(file.read(), "egg\n") |
| 785 | file.seek(0) |
| 786 | file.close() |
| 787 | self.assertRaises(ValueError, file.read) |
| 788 | with self.open(os_helper.TESTFN, "rb") as f: |
| 789 | file = self.open(f.fileno(), "rb", closefd=False) |
| 790 | self.assertEqual(file.read()[:3], b"egg") |
| 791 | file.close() |
| 792 | self.assertRaises(ValueError, file.readinto, bytearray(1)) |
| 793 | |
| 794 | def test_no_closefd_with_filename(self): |
| 795 | # can't use closefd in combination with a file name |
nothing calls this directly
no test coverage detected