diff options
| author | Anteru <bitbucket@ca.sh13.net> | 2019-01-29 11:03:58 +0000 |
|---|---|---|
| committer | Anteru <bitbucket@ca.sh13.net> | 2019-01-29 11:03:58 +0000 |
| commit | bf380caf5787e6d4c0949a4f39b54f02fc8a44ef (patch) | |
| tree | ca3dddcda314aca2d1f844586eb5c46f8305bd21 /tests/test_cmdline.py | |
| parent | 9db78a3b084ba4a8c14ff04ec85216e45ecdc0a4 (diff) | |
| parent | d5cad2f95623372e7cad9ebb581f42b5b9c1906e (diff) | |
| download | pygments-git-bf380caf5787e6d4c0949a4f39b54f02fc8a44ef.tar.gz | |
Merged in camilstaps/pygments-main-solarized (pull request #708)
Adds a solarized style
Approved-by: Anteru <bitbucket@ca.sh13.net>
Diffstat (limited to 'tests/test_cmdline.py')
| -rw-r--r-- | tests/test_cmdline.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index 1500c875..a55e30ec 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -28,6 +28,13 @@ def func(args): ''' +def _decode_output(text): + try: + return text.decode('utf-8') + except UnicodeEncodeError: # implicit encode on Python 2 with data loss + return text + + def run_cmdline(*args, **kwds): saved_stdin = sys.stdin saved_stdout = sys.stdout @@ -53,9 +60,9 @@ def run_cmdline(*args, **kwds): sys.stderr = saved_stderr new_stdout.flush() new_stderr.flush() - out, err = stdout_buffer.getvalue().decode('utf-8'), \ - stderr_buffer.getvalue().decode('utf-8') - return (ret, out, err) + out, err = stdout_buffer.getvalue(), \ + stderr_buffer.getvalue() + return (ret, _decode_output(out), _decode_output(err)) class CmdLineTest(unittest.TestCase): |
