From: Paul Brossier Date: Mon, 3 Feb 2014 14:09:04 +0000 (-0300) Subject: tests/test_decoding.py: check mime_type X-Git-Tag: 0.5.3~1^2 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=fc0e3d050fb07ace2669a6c76e2f5f05846e7e88;p=timeside.git tests/test_decoding.py: check mime_type --- diff --git a/tests/test_decoding.py b/tests/test_decoding.py index 203256a..c5459d0 100755 --- a/tests/test_decoding.py +++ b/tests/test_decoding.py @@ -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