cpython/Lib/dos-8x3/test_sun.py

21 lines
398 B
Python
Raw Normal View History

1998-08-12 10:38:11 +08:00
from test_support import verbose, findfile, TestFailed
1997-04-02 14:13:34 +08:00
import sunaudiodev
import os
def play_sound_file(path):
fp = open(path, 'r')
data = fp.read()
fp.close()
try:
1998-03-27 06:14:20 +08:00
a = sunaudiodev.open('w')
1997-04-02 14:13:34 +08:00
except sunaudiodev.error, msg:
1998-03-27 06:14:20 +08:00
raise TestFailed, msg
1997-04-02 14:13:34 +08:00
else:
1998-03-27 06:14:20 +08:00
a.write(data)
a.close()
1997-04-02 14:13:34 +08:00
def test():
play_sound_file(findfile('audiotest.au'))
test()