summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2021-12-28 18:12:45 +0100
committerGitHub <noreply@github.com>2021-12-28 18:12:45 +0100
commit34bf90dcfc8fc32fca8b84e4c56b2805fc0dd82f (patch)
tree8a1bfef947a6b4b52434ecadea7b793acbe0f86c /tests
parent7dea301f7f3baa2c5a585a90ab8d8c30332ef562 (diff)
downloadpygments-git-34bf90dcfc8fc32fca8b84e4c56b2805fc0dd82f.tar.gz
Add a tooltips option to HtmlFormatter. (#1822)
* Add a tooltips option to HtmlFormmater. * Rename option tooltips to debug_token_types. * Use explicit if block. * Fix check. * Document how to use the new debug_token_types option for the HTML formatter. * Remove output redirection from example call.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_html_formatter.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_html_formatter.py b/tests/test_html_formatter.py
index ad5d6959..d3e798db 100644
--- a/tests/test_html_formatter.py
+++ b/tests/test_html_formatter.py
@@ -247,3 +247,17 @@ def test_filename():
fmt.format(tokensource, outfile)
html = outfile.getvalue()
assert re.search("<span class=\"filename\">test.py</span><pre>", html)
+
+
+def test_debug_token_types():
+ fmt_nod_token_types = HtmlFormatter(debug_token_types=False)
+ outfile_nod_token_types = StringIO()
+ fmt_nod_token_types.format(tokensource, outfile_nod_token_types)
+ html_nod_token_types = outfile_nod_token_types.getvalue()
+ assert '<span class="n" title="Name">TESTDIR</span>' not in html_nod_token_types
+
+ fmt_debug_token_types = HtmlFormatter(debug_token_types=True)
+ outfile_debug_token_types = StringIO()
+ fmt_debug_token_types.format(tokensource, outfile_debug_token_types)
+ html_debug_token_types = outfile_debug_token_types.getvalue()
+ assert '<span class="n" title="Name">TESTDIR</span>' in html_debug_token_types