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

Method test_pcm_has_no_fact_chunk

Lib/test/test_wave.py:375–394  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

373 self.assertEqual(fact_samples, nframes)
374
375 def test_pcm_has_no_fact_chunk(self):
376 with tempfile.NamedTemporaryFile(delete_on_close=False) as fp:
377 filename = fp.name
378 self.addCleanup(unlink, filename)
379
380 with wave.open(filename, 'wb') as w:
381 w.setnchannels(1)
382 w.setsampwidth(2)
383 w.setframerate(22050)
384 w.writeframes(b'\x00\x00' * 100)
385
386 with open(filename, 'rb') as f:
387 f.read(12)
388 while True:
389 chunk_id = f.read(4)
390 if len(chunk_id) < 4:
391 break
392 chunk_size = struct.unpack('<L', f.read(4))[0]
393 self.assertNotEqual(chunk_id, b'fact')
394 f.seek(chunk_size + (chunk_size & 1), 1)
395
396 @support.subTests('arg', (
397 # rounds to 0, should raise:

Callers

nothing calls this directly

Calls 11

addCleanupMethod · 0.80
setnchannelsMethod · 0.80
setsampwidthMethod · 0.80
setframerateMethod · 0.80
writeframesMethod · 0.80
unpackMethod · 0.80
assertNotEqualMethod · 0.80
openFunction · 0.50
openMethod · 0.45
readMethod · 0.45
seekMethod · 0.45

Tested by

no test coverage detected