diff options
author | Jean Abou Samra <jean@abou-samra.fr> | 2023-01-30 03:11:54 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2023-01-31 16:30:11 +0100 |
commit | b69cae00b4a13cf306ec92d169b81c965a0865fc (patch) | |
tree | a6bef750d9fd875d56ddb50279d151dce58ffe3c /tests | |
parent | 94566ea3bf85190f21cb347ef5df7e5033e43b0f (diff) | |
download | pygments-git-b69cae00b4a13cf306ec92d169b81c965a0865fc.tar.gz |
Fix lots of missing encoding="utf-8" parameters
Some of these are probably unnecessary (ASCII-only content), but it's
easier not to think about it.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/contrast/test_contrasts.py | 4 | ||||
-rw-r--r-- | tests/test_html_formatter_linenos_elements.py | 3 | ||||
-rw-r--r-- | tests/test_latex_formatter.py | 4 |
3 files changed, 6 insertions, 5 deletions
diff --git a/tests/contrast/test_contrasts.py b/tests/contrast/test_contrasts.py index 517b34ed..cfc9b414 100644 --- a/tests/contrast/test_contrasts.py +++ b/tests/contrast/test_contrasts.py @@ -60,7 +60,7 @@ def min_contrasts(): def update_json(): - with open(JSON_FILENAME, "w") as f: + with open(JSON_FILENAME, "w", encoding="utf-8") as f: json.dump( min_contrasts(), f, @@ -69,7 +69,7 @@ def update_json(): def test_contrasts(fail_if_improved=True): - with open(JSON_FILENAME) as f: + with open(JSON_FILENAME, encoding="utf-8") as f: previous_contrasts = json.load(f) for style_name in pygments.styles.STYLE_MAP: diff --git a/tests/test_html_formatter_linenos_elements.py b/tests/test_html_formatter_linenos_elements.py index 286b60c9..af43c4b4 100644 --- a/tests/test_html_formatter_linenos_elements.py +++ b/tests/test_html_formatter_linenos_elements.py @@ -57,7 +57,8 @@ def test_linenos_elements( # import bs4 as BeautifulSoup # f.write(str(BeautifulSoup.BeautifulSoup(html, 'html.parser'))) - with open(os.path.join(EXPECTED_OUTPUT_DIR, expected_html_filename)) as f: + with open(os.path.join(EXPECTED_OUTPUT_DIR, expected_html_filename), + encoding="utf-8") as f: expected_html = f.read() structural_diff.structural_diff(html, expected_html) diff --git a/tests/test_latex_formatter.py b/tests/test_latex_formatter.py index 42c5eda7..65b3bac1 100644 --- a/tests/test_latex_formatter.py +++ b/tests/test_latex_formatter.py @@ -24,7 +24,7 @@ TESTFILE = path.join(TESTDIR, 'test_latex_formatter.py') def test_correct_output(): - with open(TESTFILE) as fp: + with open(TESTFILE, encoding='utf-8') as fp: tokensource = list(PythonLexer().get_tokens(fp.read())) hfmt = LatexFormatter(nowrap=True) houtfile = StringIO() @@ -35,7 +35,7 @@ def test_correct_output(): def test_valid_output(): - with open(TESTFILE) as fp: + with open(TESTFILE, encoding='utf-8') as fp: tokensource = list(PythonLexer().get_tokens(fp.read())) fmt = LatexFormatter(full=True, encoding='latin1') |