MCPcopy Index your code
hub / github.com/python/cpython / test_open_pathlike

Method test_open_pathlike

Lib/test/test_wave.py:435–451  ·  view source on GitHub ↗

It is possible to use `wave.read` and `wave.write` with a path-like object

(self)

Source from the content-addressed store, hash-verified

433
434class WaveOpen(unittest.TestCase):
435 def test_open_pathlike(self):
436 """It is possible to use `wave.read` and `wave.write` with a path-like object"""
437 with tempfile.NamedTemporaryFile(delete_on_close=False) as fp:
438 cases = (
439 FakePath(fp.name),
440 FakePath(os.fsencode(fp.name)),
441 os.fsencode(fp.name),
442 )
443 for fake_path in cases:
444 with self.subTest(fake_path):
445 with wave.open(fake_path, 'wb') as f:
446 f.setnchannels(1)
447 f.setsampwidth(2)
448 f.setframerate(44100)
449
450 with wave.open(fake_path, 'rb') as f:
451 pass
452
453
454if __name__ == '__main__':

Callers

nothing calls this directly

Calls 6

FakePathClass · 0.90
setnchannelsMethod · 0.80
setsampwidthMethod · 0.80
setframerateMethod · 0.80
subTestMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected