mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
Issue #19641: Added the audioop.byteswap() function to convert big-endian
samples to little-endian and vice versa.
This commit is contained in:
parent
2b38fc187c
commit
3062c9a6c8
10 changed files with 80 additions and 78 deletions
|
@ -1,6 +1,7 @@
|
|||
from test.support import TESTFN
|
||||
import unittest
|
||||
from test import audiotests
|
||||
from audioop import byteswap
|
||||
import sys
|
||||
import wave
|
||||
|
||||
|
@ -46,13 +47,7 @@ class WavePCM16Test(audiotests.AudioWriteTests,
|
|||
E4B50CEB 63440A5A 08CA0A1F 2BBA0B0B 51460E47 8BCB113C B6F50EEA 44150A59 \
|
||||
""")
|
||||
if sys.byteorder != 'big':
|
||||
frames = audiotests.byteswap2(frames)
|
||||
|
||||
if sys.byteorder == 'big':
|
||||
@unittest.expectedFailure
|
||||
def test_unseekable_incompleted_write(self):
|
||||
super().test_unseekable_incompleted_write()
|
||||
|
||||
frames = byteswap(frames, 2)
|
||||
|
||||
|
||||
class WavePCM24Test(audiotests.AudioWriteTests,
|
||||
|
@ -82,7 +77,7 @@ class WavePCM24Test(audiotests.AudioWriteTests,
|
|||
51486F0E44E1 8BCC64113B05 B6F4EC0EEB36 4413170A5B48 \
|
||||
""")
|
||||
if sys.byteorder != 'big':
|
||||
frames = audiotests.byteswap3(frames)
|
||||
frames = byteswap(frames, 3)
|
||||
|
||||
|
||||
class WavePCM32Test(audiotests.AudioWriteTests,
|
||||
|
@ -112,12 +107,7 @@ class WavePCM32Test(audiotests.AudioWriteTests,
|
|||
51486F800E44E190 8BCC6480113B0580 B6F4EC000EEB3630 441317800A5B48A0 \
|
||||
""")
|
||||
if sys.byteorder != 'big':
|
||||
frames = audiotests.byteswap4(frames)
|
||||
|
||||
if sys.byteorder == 'big':
|
||||
@unittest.expectedFailure
|
||||
def test_unseekable_incompleted_write(self):
|
||||
super().test_unseekable_incompleted_write()
|
||||
frames = byteswap(frames, 4)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue