diff options
author | Adam Turner <9087854+AA-Turner@users.noreply.github.com> | 2023-01-02 00:01:14 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-02 00:01:14 +0000 |
commit | 4032070e8131f518bbb8a04e8d63c5af4df9b59d (patch) | |
tree | 47b14f58d5337448e8358029264ebcd6d1ae7351 /tests/test_domain_cpp.py | |
parent | ede68fa423107fbab74d07b307d7dcb03c00dfbd (diff) | |
download | sphinx-git-4032070e8131f518bbb8a04e8d63c5af4df9b59d.tar.gz |
Run pyupgrade (#11070)
Diffstat (limited to 'tests/test_domain_cpp.py')
-rw-r--r-- | tests/test_domain_cpp.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/test_domain_cpp.py b/tests/test_domain_cpp.py index 8593c41f6..34d808a82 100644 --- a/tests/test_domain_cpp.py +++ b/tests/test_domain_cpp.py @@ -1199,7 +1199,7 @@ def test_domain_cpp_build_with_add_function_parentheses_is_True(app, status, war pattern = '<li><p>%s<a .*?><code .*?><span .*?>%s</span></code></a></p></li>' % spec res = re.search(pattern, text) if not res: - print("Pattern\n\t%s\nnot found in %s" % (pattern, file)) + print(f"Pattern\n\t{pattern}\nnot found in {file}") raise AssertionError() rolePatterns = [ ('', 'Sphinx'), @@ -1240,7 +1240,7 @@ def test_domain_cpp_build_with_add_function_parentheses_is_False(app, status, wa pattern = '<li><p>%s<a .*?><code .*?><span .*?>%s</span></code></a></p></li>' % spec res = re.search(pattern, text) if not res: - print("Pattern\n\t%s\nnot found in %s" % (pattern, file)) + print(f"Pattern\n\t{pattern}\nnot found in {file}") raise AssertionError() rolePatterns = [ ('', 'Sphinx'), @@ -1281,16 +1281,16 @@ def test_domain_cpp_build_xref_consistency(app, status, warning): output = (app.outdir / test).read_text(encoding='utf8') def classes(role, tag): - pattern = (r'{role}-role:.*?' - r'<(?P<tag>{tag}) .*?class=["\'](?P<classes>.*?)["\'].*?>' + pattern = (fr'{role}-role:.*?' + fr'<(?P<tag>{tag}) .*?class=["\'](?P<classes>.*?)["\'].*?>' r'.*' - r'</(?P=tag)>').format(role=role, tag=tag) + r'</(?P=tag)>') result = re.search(pattern, output) - expect = '''\ + expect = f'''\ Pattern for role `{role}` with tag `{tag}` \t{pattern} not found in `{test}` -'''.format(role=role, tag=tag, pattern=pattern, test=test) +''' assert result, expect return set(result.group('classes').split()) |