diff Lib/test/test_wave.py @ 87454:fbebc90abcd1

Issue #19641: Added the audioop.byteswap() function to convert big-endian samples to little-endian and vice versa.
author Serhiy Storchaka <storchaka@gmail.com>
date Sat, 23 Nov 2013 22:26:01 +0200
parents 7cf7f19445ba
children
line wrap: on
line diff
--- a/Lib/test/test_wave.py	Sat Nov 23 20:21:28 2013 +0000
+++ b/Lib/test/test_wave.py	Sat Nov 23 22:26:01 2013 +0200
@@ -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 @@
       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 @@
       51486F0E44E1 8BCC64113B05 B6F4EC0EEB36 4413170A5B48 \
       """)
     if sys.byteorder != 'big':
-        frames = audiotests.byteswap3(frames)
+        frames = byteswap(frames, 3)
 
 
 class WavePCM32Test(audiotests.AudioWriteTests,
@@ -112,12 +107,7 @@
       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__':