[Python-3000-checkins] r56515 - in python/branches/py3k-struni/Lib: test/test_wave.py wave.py
guido.van.rossum
python-3000-checkins at python.org
Mon Jul 23 23:28:30 CEST 2007
Author: guido.van.rossum
Date: Mon Jul 23 23:28:30 2007
New Revision: 56515
Modified:
python/branches/py3k-struni/Lib/test/test_wave.py
python/branches/py3k-struni/Lib/wave.py
Log:
Make test_wave.py pass.
I have no illusion that this fixes all issues with this module.
Modified: python/branches/py3k-struni/Lib/test/test_wave.py
==============================================================================
--- python/branches/py3k-struni/Lib/test/test_wave.py (original)
+++ python/branches/py3k-struni/Lib/test/test_wave.py Mon Jul 23 23:28:30 2007
@@ -16,7 +16,7 @@
f.setsampwidth(sampwidth)
f.setframerate(framerate)
f.setnframes(nframes)
-output = '\0' * nframes * nchannels * sampwidth
+output = b'\0' * nframes * nchannels * sampwidth
f.writeframes(output)
f.close()
Modified: python/branches/py3k-struni/Lib/wave.py
==============================================================================
--- python/branches/py3k-struni/Lib/wave.py (original)
+++ python/branches/py3k-struni/Lib/wave.py Mon Jul 23 23:28:30 2007
@@ -126,9 +126,9 @@
self._convert = None
self._soundpos = 0
self._file = Chunk(file, bigendian = 0)
- if self._file.getname() != 'RIFF':
+ if self._file.getname() != b'RIFF':
raise Error, 'file does not start with RIFF id'
- if self._file.read(4) != 'WAVE':
+ if self._file.read(4) != b'WAVE':
raise Error, 'not a WAVE file'
self._fmt_chunk_read = 0
self._data_chunk = None
@@ -139,10 +139,10 @@
except EOFError:
break
chunkname = chunk.getname()
- if chunkname == 'fmt ':
+ if chunkname == b'fmt ':
self._read_fmt_chunk(chunk)
self._fmt_chunk_read = 1
- elif chunkname == 'data':
+ elif chunkname == b'data':
if not self._fmt_chunk_read:
raise Error, 'data chunk before fmt chunk'
self._data_chunk = chunk
@@ -230,7 +230,7 @@
self._data_chunk.seek(pos, 0)
self._data_seek_needed = 0
if nframes == 0:
- return ''
+ return b''
if self._sampwidth > 1 and big_endian:
# unfortunately the fromfile() method does not take
# something that only looks like a file object, so
More information about the Python-3000-checkins
mailing list