[Python-checkins] r72104 - in python/branches/py3k: Lib/aifc.py Lib/test/Sine-1000Hz-300ms.aif Lib/test/test_aifc.py Lib/test/test_sundry.py Misc/ACKS Misc/NEWS
r.david.murray
python-checkins at python.org
Wed Apr 29 17:34:32 CEST 2009
Author: r.david.murray
Date: Wed Apr 29 17:34:32 2009
New Revision: 72104
Log:
Merged revisions 72100-72101 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72100 | r.david.murray | 2009-04-29 09:17:37 -0400 (Wed, 29 Apr 2009) | 7 lines
Fix issue 2245. aifc now skips any chunk type it doesn't actually
process instead of throwing errors for anything not in an explicit
skip list. This is per this spec: http://www.cnpbagwell.com/aiff-c.txt.
Spec reference and test sound file provided by Santiago Peresón, fix
based on patch by Hiroaki Kawai.
........
r72101 | r.david.murray | 2009-04-29 09:51:44 -0400 (Wed, 29 Apr 2009) | 2 lines
Now that we've got a test_aifc, add a few tests.
........
Added:
python/branches/py3k/Lib/test/Sine-1000Hz-300ms.aif
- copied unchanged from r72101, /python/trunk/Lib/test/Sine-1000Hz-300ms.aif
python/branches/py3k/Lib/test/test_aifc.py
- copied, changed from r72101, /python/trunk/Lib/test/test_aifc.py
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Lib/aifc.py
python/branches/py3k/Lib/test/test_sundry.py
python/branches/py3k/Misc/ACKS
python/branches/py3k/Misc/NEWS
Modified: python/branches/py3k/Lib/aifc.py
==============================================================================
--- python/branches/py3k/Lib/aifc.py (original)
+++ python/branches/py3k/Lib/aifc.py Wed Apr 29 17:34:32 2009
@@ -144,9 +144,6 @@
_AIFC_version = 0xA2805140 # Version 1 of AIFF-C
-_skiplist = b'COMT', b'INST', b'MIDI', b'AESD', \
- b'APPL', b'NAME', b'AUTH', b'(c) ', b'ANNO'
-
def _read_long(file):
try:
return struct.unpack('>l', file.read(4))[0]
@@ -313,11 +310,6 @@
self._version = _read_ulong(chunk)
elif chunkname == b'MARK':
self._readmark(chunk)
- elif chunkname in _skiplist:
- pass
- else:
- raise Error('unrecognized chunk type ' +
- chunkname.decode('latin1'))
chunk.skip()
if not self._comm_chunk_read or not self._ssnd_chunk:
raise Error('COMM chunk and/or SSND chunk missing')
Copied: python/branches/py3k/Lib/test/test_aifc.py (from r72101, /python/trunk/Lib/test/test_aifc.py)
==============================================================================
--- /python/trunk/Lib/test/test_aifc.py (original)
+++ python/branches/py3k/Lib/test/test_aifc.py Wed Apr 29 17:34:32 2009
@@ -1,4 +1,4 @@
-from test.test_support import findfile, run_unittest
+from test.support import findfile, run_unittest
import unittest
import aifc
@@ -21,26 +21,31 @@
self.assertEqual(f.getsampwidth(), 2)
self.assertEqual(f.getframerate(), 48000)
self.assertEqual(f.getnframes(), 14400)
- self.assertEqual(f.getcomptype(), 'NONE')
- self.assertEqual(f.getcompname(), 'not compressed')
- self.assertEqual(f.getparams(), (2, 2, 48000, 14400, 'NONE', 'not compressed'))
+ # XXX: are the next two correct? The docs say/imply they are supposed
+ # to be strings.
+ self.assertEqual(f.getcomptype(), b'NONE')
+ self.assertEqual(f.getcompname(), b'not compressed')
+ self.assertEqual(
+ f.getparams(),
+ (2, 2, 48000, 14400, b'NONE', b'not compressed'),
+ )
f.close()
def test_read(self):
f = aifc.open(self.sndfilepath)
self.assertEqual(f.tell(), 0)
- self.assertEqual(f.readframes(2), '\x00\x00\x00\x00\x0b\xd4\x0b\xd4')
+ self.assertEqual(f.readframes(2), b'\x00\x00\x00\x00\x0b\xd4\x0b\xd4')
f.rewind()
pos0 = f.tell()
self.assertEqual(pos0, 0)
- self.assertEqual(f.readframes(2), '\x00\x00\x00\x00\x0b\xd4\x0b\xd4')
+ self.assertEqual(f.readframes(2), b'\x00\x00\x00\x00\x0b\xd4\x0b\xd4')
pos2 = f.tell()
self.assertEqual(pos2, 2)
- self.assertEqual(f.readframes(2), '\x17t\x17t"\xad"\xad')
+ self.assertEqual(f.readframes(2), b'\x17t\x17t"\xad"\xad')
f.setpos(pos2)
- self.assertEqual(f.readframes(2), '\x17t\x17t"\xad"\xad')
+ self.assertEqual(f.readframes(2), b'\x17t\x17t"\xad"\xad')
f.setpos(pos0)
- self.assertEqual(f.readframes(2), '\x00\x00\x00\x00\x0b\xd4\x0b\xd4')
+ self.assertEqual(f.readframes(2), b'\x00\x00\x00\x00\x0b\xd4\x0b\xd4')
f.close()
#XXX Need more tests!
Modified: python/branches/py3k/Lib/test/test_sundry.py
==============================================================================
--- python/branches/py3k/Lib/test/test_sundry.py (original)
+++ python/branches/py3k/Lib/test/test_sundry.py Wed Apr 29 17:34:32 2009
@@ -9,7 +9,6 @@
def test_at_least_import_untested_modules(self):
with warnings.catch_warnings():
warnings.simplefilter("ignore")
- import aifc
import bdb
import cgitb
import code
Modified: python/branches/py3k/Misc/ACKS
==============================================================================
--- python/branches/py3k/Misc/ACKS (original)
+++ python/branches/py3k/Misc/ACKS Wed Apr 29 17:34:32 2009
@@ -372,6 +372,7 @@
Peter van Kampen
Jacob Kaplan-Moss
Lou Kates
+Hiroaki Kawai
Sebastien Keim
Robert Kern
Randall Kern
@@ -545,6 +546,7 @@
Samuele Pedroni
Marcel van der Peijl
Steven Pemberton
+Santiago Peresón
Mark Perrego
Trevor Perrin
Tim Peters
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Wed Apr 29 17:34:32 2009
@@ -473,6 +473,8 @@
Library
-------
+- Issue #2245: aifc now skips chunk types it doesn't recognize, per spec.
+
- Issue #5874: distutils.tests.test_config_cmd is not locale-sensitive
anymore.
More information about the Python-checkins
mailing list