Python pandas.io.formats.console.detect_console_encoding() Examples
The following are 6
code examples of pandas.io.formats.console.detect_console_encoding().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pandas.io.formats.console
, or try the search function
.
Example #1
Source File: test_console.py From recruit with Apache License 2.0 | 5 votes |
def test_detect_console_encoding_from_stdout_stdin(monkeypatch, empty, filled): # Ensures that when sys.stdout.encoding or sys.stdin.encoding is used when # they have values filled. # GH 21552 with monkeypatch.context() as context: context.setattr('sys.{}'.format(empty), MockEncoding('')) context.setattr('sys.{}'.format(filled), MockEncoding(filled)) assert detect_console_encoding() == filled
Example #2
Source File: test_console.py From recruit with Apache License 2.0 | 5 votes |
def test_detect_console_encoding_fallback_to_locale(monkeypatch, encoding): # GH 21552 with monkeypatch.context() as context: context.setattr('locale.getpreferredencoding', lambda: 'foo') context.setattr('sys.stdout', MockEncoding(encoding)) assert detect_console_encoding() == 'foo'
Example #3
Source File: test_console.py From recruit with Apache License 2.0 | 5 votes |
def test_detect_console_encoding_fallback_to_default(monkeypatch, std, locale): # When both the stdout/stdin encoding and locale preferred encoding checks # fail (or return 'ascii', we should default to the sys default encoding. # GH 21552 with monkeypatch.context() as context: context.setattr( 'locale.getpreferredencoding', lambda: MockEncoding.raise_or_return(locale) ) context.setattr('sys.stdout', MockEncoding(std)) context.setattr('sys.getdefaultencoding', lambda: 'sysDefaultEncoding') assert detect_console_encoding() == 'sysDefaultEncoding'
Example #4
Source File: test_console.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def test_detect_console_encoding_from_stdout_stdin(monkeypatch, empty, filled): # Ensures that when sys.stdout.encoding or sys.stdin.encoding is used when # they have values filled. # GH 21552 with monkeypatch.context() as context: context.setattr('sys.{}'.format(empty), MockEncoding('')) context.setattr('sys.{}'.format(filled), MockEncoding(filled)) assert detect_console_encoding() == filled
Example #5
Source File: test_console.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def test_detect_console_encoding_fallback_to_locale(monkeypatch, encoding): # GH 21552 with monkeypatch.context() as context: context.setattr('locale.getpreferredencoding', lambda: 'foo') context.setattr('sys.stdout', MockEncoding(encoding)) assert detect_console_encoding() == 'foo'
Example #6
Source File: test_console.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def test_detect_console_encoding_fallback_to_default(monkeypatch, std, locale): # When both the stdout/stdin encoding and locale preferred encoding checks # fail (or return 'ascii', we should default to the sys default encoding. # GH 21552 with monkeypatch.context() as context: context.setattr( 'locale.getpreferredencoding', lambda: MockEncoding.raise_or_return(locale) ) context.setattr('sys.stdout', MockEncoding(std)) context.setattr('sys.getdefaultencoding', lambda: 'sysDefaultEncoding') assert detect_console_encoding() == 'sysDefaultEncoding'