From 3ad810406cc0e605d1e288667a6450a72a3117f6 Mon Sep 17 00:00:00 2001 From: shimizukawa Date: Sat, 25 Jul 2015 19:02:47 +0200 Subject: [PATCH] Fixed #1869: Fix problems when dealing with files containing non-ASCII characters. --- CHANGES | 2 ++ tests/test_directive_code.py | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index 9817fcb1e..75fcfd2dc 100644 --- a/CHANGES +++ b/CHANGES @@ -44,6 +44,8 @@ Bugs fixed * Fixed #1855: make gettext generates broken po file for definition lists with classifier. ``term : classifier1 : classifier2``. * #1855: make gettext generates broken po file for definition lists with classifier. +* #1869: Fix problems when dealing with files containing non-ASCII characters. Thanks to + Marvin Schmidt. Release 1.3.1 (released Mar 17, 2015) diff --git a/tests/test_directive_code.py b/tests/test_directive_code.py index d75a29454..be7ee3add 100644 --- a/tests/test_directive_code.py +++ b/tests/test_directive_code.py @@ -63,7 +63,7 @@ def test_code_block_caption_html(app, status, warning): @with_app('latex', testroot='directive-code') def test_code_block_caption_latex(app, status, warning): app.builder.build_all() - latex = (app.outdir / 'Python.tex').text() + latex = (app.outdir / 'Python.tex').text(encoding='utf-8') caption = '\\caption{caption \\emph{test} rb}' assert caption in latex @@ -101,7 +101,7 @@ def test_literal_include_dedent(app, status, warning): @with_app('html', testroot='directive-code') def test_literal_include_linenos(app, status, warning): app.builder.build(['linenos']) - html = (app.outdir / 'linenos.html').text() + html = (app.outdir / 'linenos.html').text(encoding='utf-8') linenos = ( '
'
         ' 1\n'
@@ -124,7 +124,7 @@ def test_literal_include_linenos(app, status, warning):
 @with_app('html', testroot='directive-code')
 def test_literal_include_lineno_start(app, status, warning):
     app.builder.build(['lineno_start'])
-    html = (app.outdir / 'lineno_start.html').text()
+    html = (app.outdir / 'lineno_start.html').text(encoding='utf-8')
     linenos = (
         '
'
         '200\n'
@@ -147,7 +147,7 @@ def test_literal_include_lineno_start(app, status, warning):
 @with_app('html', testroot='directive-code')
 def test_literal_include_lineno_match(app, status, warning):
     app.builder.build(['lineno_match'])
-    html = (app.outdir / 'lineno_match.html').text()
+    html = (app.outdir / 'lineno_match.html').text(encoding='utf-8')
     pyobject = (
         '
'
         ' 9\n'
@@ -180,7 +180,7 @@ def test_literal_include_lineno_match(app, status, warning):
 @with_app('latex', testroot='directive-code')
 def test_literalinclude_file_whole_of_emptyline(app, status, warning):
     app.builder.build_all()
-    latex = (app.outdir / 'Python.tex').text()
+    latex = (app.outdir / 'Python.tex').text(encoding='utf-8').replace('\r\n', '\n')
     includes = (
         '\\begin{Verbatim}[commandchars=\\\\\\{\\},numbers=left,firstnumber=1,stepnumber=1]\n'
         '\n'
@@ -204,6 +204,6 @@ def test_literalinclude_caption_html(app, status, warning):
 @with_app('latex', testroot='directive-code')
 def test_literalinclude_caption_latex(app, status, warning):
     app.builder.build('index')
-    latex = (app.outdir / 'Python.tex').text()
+    latex = (app.outdir / 'Python.tex').text(encoding='utf-8')
     caption = '\\caption{caption \\textbf{test} py}'
     assert caption in latex