From 621ea60af4022f180e2ee478d36ad3166dfc9690 Mon Sep 17 00:00:00 2001 From: Bruno Cauet Date: Mon, 12 Jan 2015 22:08:11 +0100 Subject: [PATCH] Improve importer log unicode-handling test Send unicode instead of utf8-encoded string and check that the non-ASCII char is correctly handled. Bonus: use unittest.TestCase.assertIn(A, B) instead of "assert A in B". --- test/test_importer.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/test_importer.py b/test/test_importer.py index 03b99a560..7eab84e3e 100644 --- a/test/test_importer.py +++ b/test/test_importer.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # This file is part of beets. # Copyright 2015, Adrian Sampson. # @@ -1223,14 +1224,14 @@ class TagLogTest(_common.TestCase): handler = logging.StreamHandler(sio) session = _common.import_session(loghandler=handler) session.tag_log('status', 'path') - assert 'status path' in sio.getvalue() + self.assertIn('status path', sio.getvalue()) def test_tag_log_unicode(self): sio = StringIO.StringIO() handler = logging.StreamHandler(sio) session = _common.import_session(loghandler=handler) - session.tag_log('status', 'caf\xc3\xa9') - assert 'status caf' in sio.getvalue() + session.tag_log('status', u'café') # send unicode + self.assertIn(u'status café', sio.getvalue()) class ResumeImportTest(unittest.TestCase, TestHelper):