mirror of
https://github.com/beetbox/beets.git
synced 2026-02-24 00:02:20 +01:00
Tests for _{in,out}_encoding (#2041)
This commit is contained in:
parent
9898cb1678
commit
93e614c739
1 changed files with 24 additions and 0 deletions
|
|
@ -1300,6 +1300,30 @@ class CommonOptionsParserTest(unittest.TestCase, TestHelper):
|
|||
({'album': None, 'path': None, 'format': None}, []))
|
||||
|
||||
|
||||
class EncodingTest(_common.TestCase):
|
||||
"""Tests for the `terminal_encoding` config option and our
|
||||
`_in_encoding` and `_out_encoding` utility functions.
|
||||
"""
|
||||
|
||||
def out_encoding_overridden(self):
|
||||
config['terminal_encoding'] = 'fake_encoding'
|
||||
self.assertEqual(ui._out_encoding(), 'fake_encoding')
|
||||
|
||||
def in_encoding_overridden(self):
|
||||
config['terminal_encoding'] = 'fake_encoding'
|
||||
self.assertEqual(ui._in_encoding(), 'fake_encoding')
|
||||
|
||||
def out_encoding_default_utf8(self):
|
||||
with patch('sys.stdout') as stdout:
|
||||
stdout.encoding = None
|
||||
self.assertEqual(ui._out_encoding(), 'utf8')
|
||||
|
||||
def in_encoding_default_utf8(self):
|
||||
with patch('sys.stdin') as stdin:
|
||||
stdin.encoding = None
|
||||
self.assertEqual(ui._in_encoding(), 'utf8')
|
||||
|
||||
|
||||
def suite():
|
||||
return unittest.TestLoader().loadTestsFromName(__name__)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue