Skip to content

Commit 597372e

Browse files
committed
Correct formatting tests to match latest pygments
As of version 2.21.0, pygments doesn't escape quotation marks when they appear between span tags like `<span>"Hello sphinx world"</span>`. This commit updates the test data to match the new behavior. pygments/pygments#3185
1 parent e44a40e commit 597372e

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

‎tests/test_extensions/test_ext_viewcode.py‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,7 @@ def check_viewcode_output(app: SphinxTestApp) -> str:
4949
) in result
5050
assert '<span>@decorator</span>\n' in result
5151
assert f'<span>class</span>{sp}<span>Class1</span><span>:</span>\n' in result
52-
assert (
53-
'<span> </span>'
54-
'<span>&quot;&quot;&quot;this is Class1&quot;&quot;&quot;</span></div>\n'
55-
) in result
52+
assert ('<span> </span><span>"""this is Class1"""</span></div>\n') in result
5653

5754
return result
5855

‎tests/test_highlighting.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def test_default_highlight(logger: mock.Mock) -> None:
9393
ret = bridge.highlight_block('print "Hello sphinx world"', 'default')
9494
assert ret == (
9595
'<div class="highlight"><pre><span></span><span class="nb">print</span> '
96-
'<span class="s2">&quot;Hello sphinx world&quot;</span>\n</pre></div>\n'
96+
'<span class="s2">"Hello sphinx world"</span>\n</pre></div>\n'
9797
)
9898

9999
# default: fallbacks to none if highlighting failed
@@ -107,7 +107,7 @@ def test_default_highlight(logger: mock.Mock) -> None:
107107
assert ret == (
108108
'<div class="highlight"><pre><span></span><span class="nb">print</span>'
109109
'<span class="p">(</span>'
110-
'<span class="s2">&quot;Hello sphinx world&quot;</span>'
110+
'<span class="s2">"Hello sphinx world"</span>'
111111
'<span class="p">)</span>\n</pre></div>\n'
112112
)
113113

@@ -116,7 +116,7 @@ def test_default_highlight(logger: mock.Mock) -> None:
116116
assert ret == (
117117
'<div class="highlight"><pre><span></span><span class="nb">print</span>'
118118
'<span class="p">(</span>'
119-
'<span class="s2">&quot;Hello sphinx world&quot;</span>'
119+
'<span class="s2">"Hello sphinx world"</span>'
120120
'<span class="p">)</span>\n</pre></div>\n'
121121
)
122122

‎tests/test_intl/test_intl.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,7 +1647,7 @@ def test_additional_targets_should_not_be_translated(app: SphinxTestApp) -> None
16471647
assert_count(expected_expr, result, 2)
16481648

16491649
# ruby code block should not be translated but be highlighted
1650-
expected_expr = """<span class="s1">&#39;result&#39;</span>"""
1650+
expected_expr = """<span class="s1">"result"</span>"""
16511651
assert_count(expected_expr, result, 1)
16521652

16531653
# C code block without lang should not be translated and *ruby* highlighted
@@ -1746,7 +1746,7 @@ def test_additional_targets_should_be_translated(app: SphinxTestApp) -> None:
17461746
assert_count(expected_expr, result, 2)
17471747

17481748
# ruby code block should be translated and be highlighted
1749-
expected_expr = """<span class="s1">&#39;RESULT&#39;</span>"""
1749+
expected_expr = """<span class="s1">"RESULT"</span>"""
17501750
assert_count(expected_expr, result, 1)
17511751

17521752
# C code block without lang should be translated and *ruby* highlighted

0 commit comments

Comments
 (0)