Files
picard/test/test_coverart_utils.py
Wieland Hoffmann 60588b6c3e PICARD-1277 (workaround): translate_caa_type: Return the input if the type is unknown
That can happen if a new cover art type is added in MB that Picard doesn't yet
know about. Instead of raising a KeyError (and crashing), just return the raw
type, which is good enough until we have something better to show.
2018-07-03 18:02:27 +02:00

23 lines
694 B
Python

#!/usr/bin/env python
# coding: utf-8
import os.path
import shutil
import tempfile
import unittest
from picard.coverart.utils import translate_caa_type
from picard.i18n import setup_gettext
class CaaTypeTranslationTest(unittest.TestCase):
def setUp(self):
# we are using temporary locales for tests
self.tmp_path = tempfile.mkdtemp()
self.localedir = os.path.join(self.tmp_path, 'locale')
self.addCleanup(shutil.rmtree, self.tmp_path)
setup_gettext(self.localedir, "C")
def test_translating_unknown_types_returns_input(self):
testtype = "ThisIsAMadeUpCoverArtTypeName"
self.assertEqual(translate_caa_type(testtype), testtype)