mirror of
https://github.com/beetbox/beets.git
synced 2025-12-15 21:14:19 +01:00
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".
This commit is contained in:
parent
8418fb6083
commit
621ea60af4
1 changed files with 4 additions and 3 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Reference in a new issue