summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sndhdr.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2014-10-09 20:59:30 (GMT)
committerR David Murray <rdmurray@bitdance.com>2014-10-09 20:59:30 (GMT)
commit4487dd0ed5482d619279aa45099a22d0abc9615d (patch)
tree9e0919a9825e4a064ecd54209ec51bea3d49cbd9 /Lib/test/test_sndhdr.py
parentaad627f2f94c426fab6d8341ffd60ca36cc005b7 (diff)
downloadcpython-4487dd0ed5482d619279aa45099a22d0abc9615d.zip
cpython-4487dd0ed5482d619279aa45099a22d0abc9615d.tar.gz
cpython-4487dd0ed5482d619279aa45099a22d0abc9615d.tar.bz2
#18615: Make sndhdr return namedtuples.
Patch by Claudiu Popa.
Diffstat (limited to 'Lib/test/test_sndhdr.py')
-rw-r--r--Lib/test/test_sndhdr.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_sndhdr.py b/Lib/test/test_sndhdr.py
index 5e0abe0..361f70f 100644
--- a/Lib/test/test_sndhdr.py
+++ b/Lib/test/test_sndhdr.py
@@ -1,4 +1,5 @@
import sndhdr
+import pickle
import unittest
from test.support import findfile
@@ -18,6 +19,18 @@ class TestFormats(unittest.TestCase):
what = sndhdr.what(filename)
self.assertNotEqual(what, None, filename)
self.assertSequenceEqual(what, expected)
+ self.assertEqual(what.filetype, expected[0])
+ self.assertEqual(what.framerate, expected[1])
+ self.assertEqual(what.nchannels, expected[2])
+ self.assertEqual(what.nframes, expected[3])
+ self.assertEqual(what.sampwidth, expected[4])
+
+ def test_pickleable(self):
+ filename = findfile('sndhdr.aifc', subdir="sndhdrdata")
+ what = sndhdr.what(filename)
+ dump = pickle.dumps(what)
+ self.assertEqual(pickle.loads(dump), what)
+
if __name__ == '__main__':
unittest.main()