Skip to content

Commit

Permalink
Remove legacy sphinx <4 code
Browse files Browse the repository at this point in the history
  • Loading branch information
Rotzbua committed Jan 15, 2025
1 parent 542ae9b commit a4eee46
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 23 deletions.
2 changes: 0 additions & 2 deletions breathe/renderer/sphinxrenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,8 +701,6 @@ def content(contentnode):
n = declarator[0]
newStyle = True
# the new style was introduced in Sphinx v4
if sphinx.version_info[0] < 4:
newStyle = False
# but only for the C and C++ domains
if self.get_domain() and self.get_domain() not in ("c", "cpp"):
newStyle = False
Expand Down
29 changes: 8 additions & 21 deletions tests/test_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,21 +330,15 @@ def test_render_func(app):
)
signature = find_node(render(app, member_def), "desc_signature")
assert signature.astext().startswith("void")
if sphinx.version_info[0] < 4:
assert find_node(signature, "desc_name")[0] == "foo"
else:
n = find_node(signature, "desc_name")[0]
assert isinstance(n, sphinx.addnodes.desc_sig_name)
assert len(n) == 1
assert n[0] == "foo"
n = find_node(signature, "desc_name")[0]
assert isinstance(n, sphinx.addnodes.desc_sig_name)
assert len(n) == 1
assert n[0] == "foo"
params = find_node(signature, "desc_parameterlist")
assert len(params) == 1
param = params[0]
if sphinx.version_info[0] < 4:
assert param[0] == "int"
else:
assert isinstance(param[0], sphinx.addnodes.desc_sig_keyword_type)
assert param[0][0] == "int"
assert isinstance(param[0], sphinx.addnodes.desc_sig_keyword_type)
assert param[0][0] == "int"


def test_render_typedef(app):
Expand Down Expand Up @@ -373,15 +367,8 @@ def test_render_c_function_typedef(app):
)
signature = find_node(render(app, member_def, domain="c"), "desc_signature")
assert signature.astext().startswith("typedef void *")
if sphinx.version_info[0] < 4:
params = find_node(signature, "desc_parameterlist")
assert len(params) == 2
assert params[0].astext() == "float"
assert params[1].astext() == "int"
else:
# the use of desc_parameterlist in this case was not correct,
# it should only be used for a top-level function
pass
# the use of desc_parameterlist in this case was not correct,
# it should only be used for a top-level function


def test_render_using_alias(app):
Expand Down

0 comments on commit a4eee46

Please sign in to comment.