示例#1
0
 def test_none_encoding(self):
     sys.__stdout__ = StreamStub(None)
     sys.__stderr__ = StreamStub(None)
     sys.__stdin__ = StreamStub('ascii')
     assert_equal(get_console_encoding(), 'ascii')
     sys.__stdin__ = StreamStub(None)
     assert_not_none(get_console_encoding())
 def test_none_encoding(self):
     sys.__stdout__ = StreamStub(None)
     sys.__stderr__ = StreamStub(None)
     sys.__stdin__ = StreamStub('ascii')
     assert_equal(get_console_encoding(), 'ascii')
     sys.__stdin__ = StreamStub(None)
     assert_not_none(get_console_encoding())
示例#3
0
 def test_non_tty_streams_are_not_used(self):
     sys.__stdout__ = StreamStub('utf-8', isatty=False)
     sys.__stderr__ = StreamStub('latin-1', isatty=False)
     sys.__stdin__ = StreamStub('ascii')
     assert_equal(get_console_encoding(), 'ascii')
示例#4
0
 def test_invalid_encoding(self):
     sys.__stdout__ = StreamStub('invalid')
     sys.__stderr__ = StreamStub('ascII')
     assert_equal(get_console_encoding(), 'ascII')
示例#5
0
 def test_valid_encoding(self):
     sys.__stdout__ = StreamStub('ASCII')
     assert_equal(get_console_encoding(), 'ASCII')
 def test_invalid_encoding(self):
     sys.__stdout__ = StreamStub('invalid')
     sys.__stderr__ = StreamStub('ascII')
     assert_equal(get_console_encoding(), 'ascII')
 def test_valid_encoding(self):
     sys.__stdout__ = StreamStub('ASCII')
     assert_equal(get_console_encoding(), 'ASCII')