Skip to content

Commit

Permalink
chore(tests): field numbering not required since python 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Rotzbua committed May 15, 2024
1 parent 2f1b3a3 commit 424756d
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
10 changes: 5 additions & 5 deletions testing/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def make_default_config(project):
"exhale_args": {
# required arguments
"containmentFolder": "./api",
"rootFileName": "{0}_root.rst".format(project),
"rootFileTitle": "``{0}`` Test Project".format(project),
"rootFileName": "{}_root.rst".format(project),
"rootFileTitle": "``{}`` Test Project".format(project),
"doxygenStripFromPath": "..",
# additional arguments
"exhaleExecutesDoxygen": True,
Expand Down Expand Up @@ -100,7 +100,7 @@ def __new__(mcs, name, bases, attrs): # noqa: N804
)
if not isinstance(test_project, six.string_types):
raise RuntimeError(
"'test_project' in class {0} must be a string!".format(name)
"'test_project' in class {} must be a string!".format(name)
)

# looking for test methods ("test_*")
Expand Down Expand Up @@ -154,7 +154,7 @@ def _rootdir(self, app_params):
testroot = os.path.join(
TEST_PROJECTS_ROOT,
self.test_project,
"docs_{0}_{1}".format(self.__class__.__name__, self._testMethodName)
"docs_{}_{}".format(self.__class__.__name__, self._testMethodName)
)
if os.path.isdir(testroot):
shutil.rmtree(testroot)
Expand Down Expand Up @@ -442,7 +442,7 @@ def checkRequiredConfigs(self):
# validate that the title was included
with open(os.path.join(containmentFolder, rootFileName), "r") as root:
root_contents = root.read()
root_heading = "{0}\n{1}".format(
root_heading = "{}\n{}".format(
rootFileTitle,
exhale.utils.heading_mark(rootFileTitle, exhale.configs.SECTION_HEADING_CHAR)
)
Expand Down
20 changes: 10 additions & 10 deletions testing/hierarchies.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def toConsole(self, level):
``level`` (:class:`python:int`)
The recursion level, used as ``" " * level`` to indent children.
"""
print("{0}{1}".format(" " * level, self))
print("{}{}".format(" " * level, self))
for child in self.children:
child.toConsole(level + 1)

Expand Down Expand Up @@ -554,7 +554,7 @@ def _reparent_all(self):
self.unions.remove(u)

def _track_node(self, node):
lst_name = "Mapping from node.kind={0} to internal list not found.".format(node.kind)
lst_name = "Mapping from node.kind={} to internal list not found.".format(node.kind)
kind = node.kind
if kind in ["class", "struct"]:
lst_name = "class_like"
Expand All @@ -580,7 +580,7 @@ def _track_node(self, node):
lst_name = "variables"

if lst_name not in self.__dict__.keys():
raise ValueError("Invalid internal list name: {0}".format(lst_name))
raise ValueError("Invalid internal list name: {}".format(lst_name))

if node not in self.__dict__[lst_name]:
self.__dict__[lst_name].append(node)
Expand All @@ -594,14 +594,14 @@ def _visit_children(self, parent, child_spec):
if isinstance(parent, function):
if not isinstance(child_spec, parameters):
raise ValueError(
"Specification of 'function' [{0}] must be of type 'parameters'".format(parent.name)
"Specification of 'function' [{}] must be of type 'parameters'".format(parent.name)
)
else:
parent.setParameters(child_spec)
return
else:
raise ValueError(
"Specification of '{0}' [{1}] must be a dictionary.".format(parent.kind, parent.name)
"Specification of '{}' [{}] must be a dictionary.".format(parent.kind, parent.name)
)

for child in child_spec:
Expand Down Expand Up @@ -653,7 +653,7 @@ def _visit_children(self, parent, child_spec):
child.name = os.path.join(parent.name, child.name)
# simulate how Doxygen will present fully qualified names
if parent.kind in ["class", "struct", "namespace"]:
child.name = "{0}::{1}".format(parent.name, child.name)
child.name = "{}::{}".format(parent.name, child.name)
if self.hierarchy_type == "file":
child.def_in_file = parent.def_in_file
if child.kind == "namespace":
Expand Down Expand Up @@ -1185,7 +1185,7 @@ def compare_class_hierarchy(test, test_root):
if exhale_obj is None:
test.assertTrue(
False,
msg="Did not find match for [{0}] {1}".format(test_obj.kind, test_obj.name)
msg="Did not find match for [{}] {}".format(test_obj.kind, test_obj.name)
)

_compare_children("class", test, test_obj, exhale_obj)
Expand Down Expand Up @@ -1240,7 +1240,7 @@ def compare_file_hierarchy(test, test_root):
break

if exhale_obj is None:
raise RuntimeError("Did not find match for [{0}] {1}".format(
raise RuntimeError("Did not find match for [{}] {}".format(
test_obj.kind, test_obj.name
))
_compare_children("file", test, test_obj, exhale_obj)
Expand Down Expand Up @@ -1321,10 +1321,10 @@ def set_error_string(s):
"Function overload group [{group}]:\nTest:\n{test_ids}\n\nExhale:\n{exhale_ids}\n".format(
group=key,
test_ids="".join(
"\n - {0}".format(f.full_signature()) for f in test_overloads[key]
"\n - {}".format(f.full_signature()) for f in test_overloads[key]
),
exhale_ids="".join(
"\n - {0}".format(f.full_signature()) for f in exhale_overloads[key]
"\n - {}".format(f.full_signature()) for f in exhale_overloads[key]
)
)
)
Expand Down
2 changes: 1 addition & 1 deletion testing/tests/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def test_treeview_mismatch(self):
expected = "Exhale: `treeViewIsBootstrap=True` ignored since `createTreeView=False`"
self.assertTrue(
expected in sphinx_warnings,
"Sphinx Warnings did not contain '{0}'.".format(expected)
"Sphinx Warnings did not contain '{}'.".format(expected)
)


Expand Down
4 changes: 2 additions & 2 deletions testing/tests/configs_tree_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ def line_compare(self, expected_list, test_list):

self.assertTrue(
len(mismatches) == 0,
"Mismatches in line_compare:\n\n{0}".format(
"Mismatches in line_compare:\n\n{}".format(
"\n".join(
"- expected: '{0}'\n got: '{1}'".format(*item)
"- expected: '{}'\n got: '{}'".format(*item)
for item in mismatches
)
)
Expand Down
4 changes: 2 additions & 2 deletions testing/tests/cpp_fortran_mixed.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def validate_pygments_lexers(self, exhale_root, node_map):
lexer = lexer_match.groups()[0]
self.assertTrue(
lexer == expected_lexer,
"{0}: expected '{1}' but got '{2}' language lexer.".format(
"{}: expected '{}' but got '{}' language lexer.".format(
file_node.location, expected_lexer, lexer
)
)
Expand All @@ -118,7 +118,7 @@ def validate_pygments_lexers(self, exhale_root, node_map):
# Make sure we actually ran a check for this file.
self.assertTrue(
lexer_was_asserted,
"Did not find '.. code-block:: xxxx' in [{0}]".format(program_listing_file_path)
"Did not find '.. code-block:: xxxx' in [{}]".format(program_listing_file_path)
)

def get_hpp_and_f90_nodes(self, exhale_root):
Expand Down
4 changes: 2 additions & 2 deletions testing/tests/cpp_long_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def create_absurd_directory_structure():
'''))
except Exception as e:
raise RuntimeError(
"Could not make the absurd directory structure: {0}".format(e)
"Could not make the absurd directory structure: {}".format(e)
)


Expand All @@ -83,7 +83,7 @@ def remove_absurd_directory_structure():
if os.path.isdir(absurd_dir_root):
shutil.rmtree(absurd_dir_root)
except Exception as e:
raise RuntimeError("Could not remove the directory [{0}]: {1}".format(
raise RuntimeError("Could not remove the directory [{}]: {}".format(
absurd_dir_root, e
))

Expand Down

0 comments on commit 424756d

Please sign in to comment.