Staging
v0.5.1
https://github.com/python/cpython
Revision ec158087ef9963ec7fbea90250e695631488fbb0 authored by Jack Jansen on 25 March 2002, 10:30:36 UTC, committed by Jack Jansen on 25 March 2002, 10:30:36 UTC
Weaklink most toolbox modules, improving backward compatibility. Modules will no longer fail to load if a single routine is missing on the curent OS version, in stead calling the missing routine will raise an exception.

Should finally fix 531398. 2.2.1 candidate.

Also blacklisted some constants with definitions that were not Python-compatible.
1 parent c629efa
Raw File
Tip revision: ec158087ef9963ec7fbea90250e695631488fbb0 authored by Jack Jansen on 25 March 2002, 10:30:36 UTC
Backport of _Appmodule.c 1.10, appsupport.py 1.14:
Tip revision: ec15808
test_wave.py
from test_support import TestFailed
import os, tempfile
import wave

def check(t, msg=None):
    if not t:
        raise TestFailed, msg

nchannels = 2
sampwidth = 2
framerate = 8000
nframes = 100

testfile = tempfile.mktemp()

f = wave.open(testfile, 'wb')
f.setnchannels(nchannels)
f.setsampwidth(sampwidth)
f.setframerate(framerate)
f.setnframes(nframes)
output = '\0' * nframes * nchannels * sampwidth
f.writeframes(output)
f.close()

f = wave.open(testfile, 'rb')
check(nchannels == f.getnchannels(), "nchannels")
check(sampwidth == f.getsampwidth(), "sampwidth")
check(framerate == f.getframerate(), "framerate")
check(nframes == f.getnframes(), "nframes")
input = f.readframes(nframes)
check(input == output, "data")
f.close()

os.remove(testfile)
back to top