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_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')
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')