1 from test
.test_support
import TESTFN
, run_unittest
11 class TestWave(unittest
.TestCase
):
17 if self
.f
is not None:
25 self
.f
= wave
.open(TESTFN
, 'wb')
26 self
.f
.setnchannels(nchannels
)
27 self
.f
.setsampwidth(sampwidth
)
28 self
.f
.setframerate(framerate
)
29 self
.f
.setnframes(nframes
)
30 output
= '\0' * nframes
* nchannels
* sampwidth
31 self
.f
.writeframes(output
)
34 self
.f
= wave
.open(TESTFN
, 'rb')
35 self
.assertEqual(nchannels
, self
.f
.getnchannels())
36 self
.assertEqual(sampwidth
, self
.f
.getsampwidth())
37 self
.assertEqual(framerate
, self
.f
.getframerate())
38 self
.assertEqual(nframes
, self
.f
.getnframes())
39 self
.assertEqual(self
.f
.readframes(nframes
), output
)
42 run_unittest(TestWave
)
44 if __name__
== '__main__':