Victor Stinner | e9ebde4 | 2010-07-13 23:04:56 +0000 | [diff] [blame] | 1 | import sndhdr |
| 2 | import unittest |
| 3 | from test.support import findfile |
| 4 | |
| 5 | class TestFormats(unittest.TestCase): |
| 6 | def test_data(self): |
| 7 | for filename, expected in ( |
| 8 | ('sndhdr.8svx', ('8svx', 0, 1, 0, 8)), |
| 9 | ('sndhdr.aifc', ('aifc', 44100, 2, 5, 16)), |
| 10 | ('sndhdr.aiff', ('aiff', 44100, 2, 5, 16)), |
| 11 | ('sndhdr.au', ('au', 44100, 2, 5.0, 16)), |
| 12 | ('sndhdr.hcom', ('hcom', 22050.0, 1, -1, 8)), |
| 13 | ('sndhdr.sndt', ('sndt', 44100, 1, 5, 8)), |
| 14 | ('sndhdr.voc', ('voc', 0, 1, -1, 8)), |
R David Murray | 1a48b9d | 2013-03-18 17:42:42 -0400 | [diff] [blame] | 15 | ('sndhdr.wav', ('wav', 44100, 2, 5, 16)), |
Victor Stinner | e9ebde4 | 2010-07-13 23:04:56 +0000 | [diff] [blame] | 16 | ): |
| 17 | filename = findfile(filename, subdir="sndhdrdata") |
| 18 | what = sndhdr.what(filename) |
| 19 | self.assertNotEqual(what, None, filename) |
| 20 | self.assertSequenceEqual(what, expected) |
| 21 | |
| 22 | if __name__ == '__main__': |
| 23 | unittest.main() |