(self)
| 342 | self.assertIsNone(cm.unraisable) |
| 343 | |
| 344 | def test_ieee_float_has_fact_chunk(self): |
| 345 | nframes = 100 |
| 346 | with tempfile.NamedTemporaryFile(delete_on_close=False) as fp: |
| 347 | filename = fp.name |
| 348 | self.addCleanup(unlink, filename) |
| 349 | |
| 350 | with wave.open(filename, 'wb') as w: |
| 351 | w.setnchannels(1) |
| 352 | w.setsampwidth(4) |
| 353 | w.setframerate(22050) |
| 354 | w.setformat(wave.WAVE_FORMAT_IEEE_FLOAT) |
| 355 | w.writeframes(b'\x00\x00\x00\x00' * nframes) |
| 356 | |
| 357 | with open(filename, 'rb') as f: |
| 358 | f.read(12) |
| 359 | fact_found = False |
| 360 | fact_samples = None |
| 361 | while True: |
| 362 | chunk_id = f.read(4) |
| 363 | if len(chunk_id) < 4: |
| 364 | break |
| 365 | chunk_size = struct.unpack('<L', f.read(4))[0] |
| 366 | if chunk_id == b'fact': |
| 367 | fact_found = True |
| 368 | fact_samples = struct.unpack('<L', f.read(4))[0] |
| 369 | break |
| 370 | f.seek(chunk_size + (chunk_size & 1), 1) |
| 371 | |
| 372 | self.assertTrue(fact_found) |
| 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: |
nothing calls this directly
no test coverage detected