|
12 | 12 | import os |
13 | 13 | import re |
14 | 14 |
|
| 15 | +import pygments |
15 | 16 | import pytest |
16 | 17 | from babel.messages import mofile, pofile |
17 | 18 | from babel.messages.catalog import Catalog |
|
30 | 31 | }, |
31 | 32 | ) |
32 | 33 |
|
| 34 | +pygments_version = tuple(int(v) for v in pygments.__version__.split('.')) |
| 35 | + |
33 | 36 |
|
34 | 37 | def read_po(pathname): |
35 | 38 | with pathname.open() as f: |
@@ -1060,8 +1063,13 @@ def test_additional_targets_should_not_be_translated(app): |
1060 | 1063 | assert_count(expected_expr, result, 1) |
1061 | 1064 |
|
1062 | 1065 | # C code block with lang should not be translated but be *C* highlighted |
1063 | | - expected_expr = ("""<span class="cp">#include</span> """ |
1064 | | - """<span class="cpf"><stdio.h></span>""") |
| 1066 | + if pygments_version < (2, 10, 0): |
| 1067 | + expected_expr = ("""<span class="cp">#include</span> """ |
| 1068 | + """<span class="cpf"><stdio.h></span>""") |
| 1069 | + else: |
| 1070 | + expected_expr = ("""<span class="cp">#include</span>""" |
| 1071 | + """<span class="w"> </span>""" |
| 1072 | + """<span class="cpf"><stdio.h></span>""") |
1065 | 1073 | assert_count(expected_expr, result, 1) |
1066 | 1074 |
|
1067 | 1075 | # literal block in list item should not be translated |
@@ -1138,8 +1146,13 @@ def test_additional_targets_should_be_translated(app): |
1138 | 1146 | assert_count(expected_expr, result, 1) |
1139 | 1147 |
|
1140 | 1148 | # C code block with lang should be translated and be *C* highlighted |
1141 | | - expected_expr = ("""<span class="cp">#include</span> """ |
1142 | | - """<span class="cpf"><STDIO.H></span>""") |
| 1149 | + if pygments_version < (2, 10, 0): |
| 1150 | + expected_expr = ("""<span class="cp">#include</span> """ |
| 1151 | + """<span class="cpf"><STDIO.H></span>""") |
| 1152 | + else: |
| 1153 | + expected_expr = ("""<span class="cp">#include</span>""" |
| 1154 | + """<span class="w"> </span>""" |
| 1155 | + """<span class="cpf"><STDIO.H></span>""") |
1143 | 1156 | assert_count(expected_expr, result, 1) |
1144 | 1157 |
|
1145 | 1158 | # literal block in list item should be translated |
|
0 commit comments