(self)
| 94 | pass |
| 95 | |
| 96 | def test_context_manager_with_open_file(self): |
| 97 | with open(TESTFN, 'wb') as testfile: |
| 98 | with self.module.open(testfile) as f: |
| 99 | f.setnchannels(self.nchannels) |
| 100 | f.setsampwidth(self.sampwidth) |
| 101 | f.setframerate(self.framerate) |
| 102 | f.setcomptype(self.comptype, self.compname) |
| 103 | self.assertEqual(testfile.closed, self.close_fd) |
| 104 | with open(TESTFN, 'rb') as testfile: |
| 105 | with self.module.open(testfile) as f: |
| 106 | self.assertFalse(f.getfp().closed) |
| 107 | params = f.getparams() |
| 108 | self.assertEqual(params.nchannels, self.nchannels) |
| 109 | self.assertEqual(params.sampwidth, self.sampwidth) |
| 110 | self.assertEqual(params.framerate, self.framerate) |
| 111 | if not self.close_fd: |
| 112 | self.assertIsNone(f.getfp()) |
| 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 |
nothing calls this directly
no test coverage detected