(self)
| 113 | self.assertEqual(testfile.closed, self.close_fd) |
| 114 | |
| 115 | def test_context_manager_with_filename(self): |
| 116 | # If the file doesn't get closed, this test won't fail, but it will |
| 117 | # produce a resource leak warning. |
| 118 | with self.module.open(TESTFN, 'wb') as f: |
| 119 | f.setnchannels(self.nchannels) |
| 120 | f.setsampwidth(self.sampwidth) |
| 121 | f.setframerate(self.framerate) |
| 122 | f.setcomptype(self.comptype, self.compname) |
| 123 | with self.module.open(TESTFN) as f: |
| 124 | self.assertFalse(f.getfp().closed) |
| 125 | params = f.getparams() |
| 126 | self.assertEqual(params.nchannels, self.nchannels) |
| 127 | self.assertEqual(params.sampwidth, self.sampwidth) |
| 128 | self.assertEqual(params.framerate, self.framerate) |
| 129 | if not self.close_fd: |
| 130 | self.assertIsNone(f.getfp()) |
| 131 | |
| 132 | def test_write(self): |
| 133 | f = self.create_file(TESTFN) |
nothing calls this directly
no test coverage detected