summaryrefslogtreecommitdiff
path: root/tests/test_html_formatter_linenos_elements.py
diff options
context:
space:
mode:
authorMatthäus G. Chajdas <dev@anteru.net>2021-12-06 18:51:39 +0100
committerMatthäus G. Chajdas <dev@anteru.net>2021-12-06 18:51:39 +0100
commitd1f186741009030522e05ce6577a8a194245a22a (patch)
tree3df179c3d283ce662afa7256551a8c8edbdc8756 /tests/test_html_formatter_linenos_elements.py
parentd15da3149270c11d67677b31d455ea557b3a3492 (diff)
downloadpygments-git-d1f186741009030522e05ce6577a8a194245a22a.tar.gz
Update HTML tests.
This includes a new structural diff which is more robust, as it handles changes like different attribute order.
Diffstat (limited to 'tests/test_html_formatter_linenos_elements.py')
-rw-r--r--tests/test_html_formatter_linenos_elements.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/test_html_formatter_linenos_elements.py b/tests/test_html_formatter_linenos_elements.py
index ea98a049..286b60c9 100644
--- a/tests/test_html_formatter_linenos_elements.py
+++ b/tests/test_html_formatter_linenos_elements.py
@@ -6,6 +6,7 @@ import pytest
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
+from .support import structural_diff
TESTDIR = os.path.dirname(os.path.abspath(__file__))
EXPECTED_OUTPUT_DIR = os.path.join(TESTDIR, "html_linenos_expected_output")
@@ -52,7 +53,11 @@ def test_linenos_elements(
filename_parts.append("filename" if filename else "nofilename")
expected_html_filename = "_".join(filename_parts) + ".html"
+ # with open(os.path.join(EXPECTED_OUTPUT_DIR, expected_html_filename), 'w') as f:
+ # 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:
expected_html = f.read()
- assert single_line(html) == single_line(expected_html)
+ structural_diff.structural_diff(html, expected_html)