Skip to content

Commit

Permalink
Add tests for guess_format
Browse files Browse the repository at this point in the history
  • Loading branch information
samj1912 committed Jan 4, 2017
1 parent 0212c37 commit 22b6fce
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/test_formats.py
Expand Up @@ -4,7 +4,6 @@
import unittest
import shutil


from PyQt4 import QtCore
from picard import config, log
from picard.coverart.image import CoverArtImage, TagCoverArtImage
Expand Down Expand Up @@ -158,6 +157,16 @@ def test_ratings(self):
loaded_metadata = save_and_load_metadata(self.filename, metadata)
self.assertEqual(int(loaded_metadata['~rating']), rating, '~rating: %r != %r' % (loaded_metadata['~rating'], rating))

def test_guess_format(self):
if self.original:
fd, temp_file = mkstemp(suffix=".test")
os.close(fd)
shutil.copy(self.original, temp_file)
audio = picard.formats.guess_format(temp_file)
audio_original = picard.formats.open(self.filename)
self.assertEqual(type(audio), type(audio_original))
os.unlink(temp_file)


class FLACTest(FormatsTest):
original = os.path.join('test', 'data', 'test.flac')
Expand Down

0 comments on commit 22b6fce

Please sign in to comment.