summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-07-23 21:28:30 (GMT)
committerGuido van Rossum <guido@python.org>2007-07-23 21:28:30 (GMT)
commit51a883bf87ec437e52a29bcd0ebd1d0bdd2d41e5 (patch)
treed1c5355b572a7d3f3798d185e4b9eccdebc372d8
parentf761e104f61599c6f51c2efd9576c724f9fbf9a5 (diff)
downloadcpython-51a883bf87ec437e52a29bcd0ebd1d0bdd2d41e5.zip
cpython-51a883bf87ec437e52a29bcd0ebd1d0bdd2d41e5.tar.gz
cpython-51a883bf87ec437e52a29bcd0ebd1d0bdd2d41e5.tar.bz2
Make test_wave.py pass.
I have no illusion that this fixes all issues with this module.
-rw-r--r--Lib/test/test_wave.py2
-rw-r--r--Lib/wave.py10
2 files changed, 6 insertions, 6 deletions
diff --git a/Lib/test/test_wave.py b/Lib/test/test_wave.py
index 1a6ff5c..85f5566 100644
--- a/Lib/test/test_wave.py
+++ b/Lib/test/test_wave.py
@@ -16,7 +16,7 @@ f.setnchannels(nchannels)
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()
diff --git a/Lib/wave.py b/Lib/wave.py
index 66d07e5..e0025ec 100644
--- a/Lib/wave.py
+++ b/Lib/wave.py
@@ -126,9 +126,9 @@ class Wave_read:
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 @@ class Wave_read:
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 @@ class Wave_read:
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