mirror of
https://github.com/python/cpython.git
synced 2025-10-13 10:23:28 +00:00
Issue #18901: The sunau getparams method now returns a namedtuple rather than
a plain tuple. Patch by Claudiu Popa.
This commit is contained in:
parent
4c6a020a2d
commit
e06a89655a
5 changed files with 47 additions and 9 deletions
|
@ -1,5 +1,6 @@
|
|||
from test.support import run_unittest, TESTFN
|
||||
import unittest
|
||||
import pickle
|
||||
import os
|
||||
|
||||
import sunau
|
||||
|
@ -62,6 +63,27 @@ class SunAUTest(unittest.TestCase):
|
|||
self.assertEqual(self.f.readframes(nframes), output)
|
||||
self.f.close()
|
||||
|
||||
def test_getparams(self):
|
||||
self.f = sunau.open(TESTFN, 'w')
|
||||
self.f.setnchannels(nchannels)
|
||||
self.f.setsampwidth(sampwidth)
|
||||
self.f.setframerate(framerate)
|
||||
self.f.setcomptype('ULAW', '')
|
||||
output = b'\0' * nframes * nchannels * sampwidth
|
||||
self.f.writeframes(output)
|
||||
self.f.close()
|
||||
|
||||
self.f = sunau.open(TESTFN, 'rb')
|
||||
params = self.f.getparams()
|
||||
self.assertEqual(params.nchannels, nchannels)
|
||||
self.assertEqual(params.sampwidth, sampwidth)
|
||||
self.assertEqual(params.framerate, framerate)
|
||||
self.assertEqual(params.nframes, nframes)
|
||||
self.assertEqual(params.comptype, 'ULAW')
|
||||
|
||||
dump = pickle.dumps(params)
|
||||
self.assertEqual(pickle.loads(dump), params)
|
||||
|
||||
|
||||
def test_main():
|
||||
run_unittest(SunAUTest)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue