]> git.parisson.com Git - timeside.git/commitdiff
tests/test_decoding.py: check mime_type
authorPaul Brossier <piem@piem.org>
Mon, 3 Feb 2014 14:09:04 +0000 (11:09 -0300)
committerPaul Brossier <piem@piem.org>
Mon, 3 Feb 2014 14:09:04 +0000 (11:09 -0300)
tests/test_decoding.py

index 203256a7abf25e85b47c025b8f104acb4a252e44..c5459d02e975329de5409446b060e4265de5dc10 100755 (executable)
@@ -27,6 +27,7 @@ class TestDecoding(unittest.TestCase):
         self.expected_totalframes = 352800
         self.test_exact_duration = True
         self.source_duration = 8
+        self.expected_mime_type = 'audio/x-wav'
 
     def testWav(self):
         "Test wav decoding"
@@ -55,6 +56,7 @@ class TestDecoding(unittest.TestCase):
         "Test flac decoding"
         self.source = os.path.join(os.path.dirname(__file__),
                                    "samples/sweep.flac")
+        self.expected_mime_type = 'audio/flac'
 
     def testOgg(self):
         "Test ogg decoding"
@@ -62,6 +64,7 @@ class TestDecoding(unittest.TestCase):
                                    "samples/sweep.ogg")
 
         self.expected_totalframes = 352832
+        self.expected_mime_type = 'audio/ogg'
         self.test_exact_duration = False
 
     def testMp3(self):
@@ -70,6 +73,7 @@ class TestDecoding(unittest.TestCase):
                                    "samples/sweep.mp3")
 
         self.expected_totalframes = 353664
+        self.expected_mime_type = 'audio/mpeg'
         self.test_exact_duration = False
 
     def tearDown(self):
@@ -97,6 +101,7 @@ class TestDecoding(unittest.TestCase):
             print "input / output_channels:", decoder.input_channels, decoder.output_channels
             print "input_duration:", decoder.input_duration
             print "input_totalframes:", decoder.input_totalframes
+            print "mime_type", decoder.mime_type()
 
         if self.channels:
             # when specified, check that the channels are the ones requested
@@ -118,6 +123,8 @@ class TestDecoding(unittest.TestCase):
                 self.assertEqual(
                     self.expected_samplerate, decoder.output_samplerate)
 
+        self.assertEqual(decoder.mime_type(), self.expected_mime_type)
+
         self.assertEqual(totalframes, self.expected_totalframes)
         input_duration = decoder.input_totalframes / decoder.input_samplerate
         output_duration = decoder.totalframes() / decoder.output_samplerate