diff options
author | Adam Turner <9087854+aa-turner@users.noreply.github.com> | 2022-09-25 21:36:30 +0100 |
---|---|---|
committer | Adam Turner <9087854+aa-turner@users.noreply.github.com> | 2022-09-25 21:36:30 +0100 |
commit | f01d50d695bf55f1af34b87c4e6c84f76dd9a36d (patch) | |
tree | e98dc537312410d5661ae76c72306d3a8d2a8e49 /tests/test_highlighting.py | |
parent | 7ad0fcf22dbff5ee80a644e46429ff2ec3f25980 (diff) | |
parent | eb5b3aa25dbc918c8250a2336aaaf2b753ad36b5 (diff) | |
download | sphinx-git-f01d50d695bf55f1af34b87c4e6c84f76dd9a36d.tar.gz |
Merge branch '5.x'
# Conflicts:
# CHANGES
# doc/conf.py
# sphinx/__init__.py
# sphinx/builders/html/__init__.py
# sphinx/domains/python.py
# tests/test_build_html.py
Diffstat (limited to 'tests/test_highlighting.py')
-rw-r--r-- | tests/test_highlighting.py | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/tests/test_highlighting.py b/tests/test_highlighting.py index 92276a21c..d7e3625c4 100644 --- a/tests/test_highlighting.py +++ b/tests/test_highlighting.py @@ -81,14 +81,23 @@ def test_default_highlight(logger): ret = bridge.highlight_block('reST ``like`` text', 'default') assert ret == '<div class="highlight"><pre><span></span>reST ``like`` text\n</pre></div>\n' - # python3: highlights as python3 - ret = bridge.highlight_block('print "Hello sphinx world"', 'python3') - assert ret == ('<div class="highlight"><pre><span></span><span class="nb">print</span> ' - '<span class="s2">"Hello sphinx world"</span>\n</pre></div>\n') + # python: highlights as python3 + ret = bridge.highlight_block('print("Hello sphinx world")', 'python') + assert ret == ('<div class="highlight"><pre><span></span><span class="nb">print</span>' + '<span class="p">(</span>' + '<span class="s2">"Hello sphinx world"</span>' + '<span class="p">)</span>\n</pre></div>\n') - # python3: raises error if highlighting failed - ret = bridge.highlight_block('reST ``like`` text', 'python3') + # python3: highlights as python3 + ret = bridge.highlight_block('print("Hello sphinx world")', 'python3') + assert ret == ('<div class="highlight"><pre><span></span><span class="nb">print</span>' + '<span class="p">(</span>' + '<span class="s2">"Hello sphinx world"</span>' + '<span class="p">)</span>\n</pre></div>\n') + + # python: raises error if highlighting failed + ret = bridge.highlight_block('reST ``like`` text', 'python') logger.warning.assert_called_with('Could not lex literal_block as "%s". ' - 'Highlighting skipped.', 'python3', + 'Highlighting skipped.', 'python', type='misc', subtype='highlighting_failure', location=None) |