Merge "Fix pep8 tests for lambda"
This commit is contained in:
@@ -86,10 +86,9 @@ class App(object):
|
||||
# works around a problem with Python 2.6 fixed in 2.7 and
|
||||
# later (http://hg.python.org/cpython/rev/e60ef17561dc/).
|
||||
lang, encoding = locale.getdefaultlocale()
|
||||
encoding = (getattr(sys.stdout, 'encoding', None)
|
||||
or encoding
|
||||
or self.DEFAULT_OUTPUT_ENCODING
|
||||
)
|
||||
encoding = (getattr(sys.stdout, 'encoding', None) or
|
||||
encoding or
|
||||
self.DEFAULT_OUTPUT_ENCODING)
|
||||
self.stdin = stdin or codecs.getreader(encoding)(sys.stdin)
|
||||
self.stdout = stdout or codecs.getwriter(encoding)(sys.stdout)
|
||||
self.stderr = stderr or codecs.getwriter(encoding)(sys.stderr)
|
||||
|
@@ -254,7 +254,8 @@ def test_output_encoding_default():
|
||||
)
|
||||
|
||||
stdout = StringIO()
|
||||
getdefaultlocale = lambda: ('ignored', 'utf-8')
|
||||
|
||||
getdefaultlocale = mock.Mock(return_value=('ignored', 'utf-8'))
|
||||
|
||||
with mock.patch('sys.stdout', stdout):
|
||||
with mock.patch('locale.getdefaultlocale', getdefaultlocale):
|
||||
@@ -281,7 +282,7 @@ def test_output_encoding_cliff_default():
|
||||
)
|
||||
|
||||
stdout = StringIO()
|
||||
getdefaultlocale = lambda: ('ignored', None)
|
||||
getdefaultlocale = mock.Mock(return_value=('ignored', None))
|
||||
|
||||
with mock.patch('sys.stdout', stdout):
|
||||
with mock.patch('locale.getdefaultlocale', getdefaultlocale):
|
||||
@@ -309,7 +310,7 @@ def test_output_encoding_sys():
|
||||
|
||||
stdout = StringIO()
|
||||
stdout.encoding = 'utf-8'
|
||||
getdefaultlocale = lambda: ('ignored', 'utf-16')
|
||||
getdefaultlocale = mock.Mock(return_value=('ignored', 'utf-16'))
|
||||
|
||||
with mock.patch('sys.stdout', stdout):
|
||||
with mock.patch('locale.getdefaultlocale', getdefaultlocale):
|
||||
@@ -336,7 +337,7 @@ def test_error_encoding_default():
|
||||
)
|
||||
|
||||
stderr = StringIO()
|
||||
getdefaultlocale = lambda: ('ignored', 'utf-8')
|
||||
getdefaultlocale = mock.Mock(return_value=('ignored', 'utf-8'))
|
||||
|
||||
with mock.patch('sys.stderr', stderr):
|
||||
with mock.patch('locale.getdefaultlocale', getdefaultlocale):
|
||||
@@ -365,7 +366,7 @@ def test_error_encoding_sys():
|
||||
stdout = StringIO()
|
||||
stdout.encoding = 'utf-8'
|
||||
stderr = StringIO()
|
||||
getdefaultlocale = lambda: ('ignored', 'utf-16')
|
||||
getdefaultlocale = mock.Mock(return_value=('ignored', 'utf-16'))
|
||||
|
||||
with mock.patch('sys.stdout', stdout):
|
||||
with mock.patch('sys.stderr', stderr):
|
||||
|
Reference in New Issue
Block a user