|
11 | 11 | import time |
12 | 12 | from typing import TYPE_CHECKING |
13 | 13 |
|
| 14 | +import pygments |
14 | 15 | import pytest |
15 | 16 | from babel.messages import mofile, pofile |
16 | 17 | from babel.messages.catalog import Catalog |
@@ -1487,6 +1488,11 @@ def test_xml_strange_markup(app): |
1487 | 1488 | @pytest.mark.sphinx('html', testroot='intl') |
1488 | 1489 | @pytest.mark.test_params(shared_result='test_intl_basic') |
1489 | 1490 | def test_additional_targets_should_not_be_translated(app): |
| 1491 | + if tuple(map(int, pygments.__version__.split('.')[:2])) >= (2, 19): |
| 1492 | + sp = '<span class="w"> </span>' |
| 1493 | + else: |
| 1494 | + sp = ' ' |
| 1495 | + |
1490 | 1496 | app.build() |
1491 | 1497 | # [literalblock.txt] |
1492 | 1498 | result = (app.outdir / 'literalblock.html').read_text(encoding='utf8') |
@@ -1525,7 +1531,7 @@ def test_additional_targets_should_not_be_translated(app): |
1525 | 1531 | # doctest block should not be translated but be highlighted |
1526 | 1532 | expected_expr = ( |
1527 | 1533 | """<span class="gp">>>> </span>""" |
1528 | | - """<span class="kn">import</span> <span class="nn">sys</span> """ |
| 1534 | + f"""<span class="kn">import</span>{sp}<span class="nn">sys</span> """ |
1529 | 1535 | """<span class="c1"># sys importing</span>""" |
1530 | 1536 | ) |
1531 | 1537 | assert_count(expected_expr, result, 1) |
@@ -1570,6 +1576,11 @@ def test_additional_targets_should_not_be_translated(app): |
1570 | 1576 | }, |
1571 | 1577 | ) |
1572 | 1578 | def test_additional_targets_should_be_translated(app): |
| 1579 | + if tuple(map(int, pygments.__version__.split('.')[:2])) >= (2, 19): |
| 1580 | + sp = '<span class="w"> </span>' |
| 1581 | + else: |
| 1582 | + sp = ' ' |
| 1583 | + |
1573 | 1584 | app.build() |
1574 | 1585 | # [literalblock.txt] |
1575 | 1586 | result = (app.outdir / 'literalblock.html').read_text(encoding='utf8') |
@@ -1619,7 +1630,7 @@ def test_additional_targets_should_be_translated(app): |
1619 | 1630 | # doctest block should not be translated but be highlighted |
1620 | 1631 | expected_expr = ( |
1621 | 1632 | """<span class="gp">>>> </span>""" |
1622 | | - """<span class="kn">import</span> <span class="nn">sys</span> """ |
| 1633 | + f"""<span class="kn">import</span>{sp}<span class="nn">sys</span> """ |
1623 | 1634 | """<span class="c1"># SYS IMPORTING</span>""" |
1624 | 1635 | ) |
1625 | 1636 | assert_count(expected_expr, result, 1) |
|
0 commit comments