Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: 09a7df8301bef5a5ac957371ae9e19c68acdca0a authored by Georg Brandl on 19 December 2010, 12:33:52 UTC
#3243 follow-up: remove debugging print and fix docs; data is a bytes object.
Tip revision: 09a7df8
test_sndhdr.py
import sndhdr
import unittest
from test.support import findfile

class TestFormats(unittest.TestCase):
    def test_data(self):
        for filename, expected in (
            ('sndhdr.8svx', ('8svx', 0, 1, 0, 8)),
            ('sndhdr.aifc', ('aifc', 44100, 2, 5, 16)),
            ('sndhdr.aiff', ('aiff', 44100, 2, 5, 16)),
            ('sndhdr.au', ('au', 44100, 2, 5.0, 16)),
            ('sndhdr.hcom', ('hcom', 22050.0, 1, -1, 8)),
            ('sndhdr.sndt', ('sndt', 44100, 1, 5, 8)),
            ('sndhdr.voc', ('voc', 0, 1, -1, 8)),
            ('sndhdr.wav', ('wav', 44100, 2, -1, 16)),
        ):
            filename = findfile(filename, subdir="sndhdrdata")
            what = sndhdr.what(filename)
            self.assertNotEqual(what, None, filename)
            self.assertSequenceEqual(what, expected)

if __name__ == '__main__':
    unittest.main()
back to top