From 687cc717c6f079039fe6c8389d37f8cd8561e4d9 Mon Sep 17 00:00:00 2001 From: Stephen McDowell Date: Sun, 28 Nov 2021 19:19:45 -0500 Subject: [PATCH] restructure testing framework (#123) - each testing/projects/{project} is dynamically imported - provides definitions for expected class / file hierarchies - hierarchies are deep copied, tests that reuse previously mutated these - docs updated to use automodule, except `cpp with spaces` (not possible to document in sphinx) - ignore `from collections import MutableMapping` warnings (see also #119) - skip mac builds on CI until #122 is solved - install correct beautiful soup package in tox.ini - fix url parsing in docs/testproject.py --- .github/workflows/test_python.yaml | 12 +- docs/testing.rst | 1 + docs/testing/projects.rst | 49 ++++ docs/testproject.py | 6 +- setup.cfg | 2 + testing/base.py | 20 ++ testing/hierarchies.py | 33 ++- testing/projects/__init__.py | 3 + testing/projects/c_maths/__init__.py | 22 ++ testing/projects/cpp with spaces/__init__.py | 25 +++ .../projects/cpp_fortran_mixed/__init__.py | 43 ++++ .../projects/cpp_func_overloads/__init__.py | 68 ++++++ testing/projects/cpp_long_names/__init__.py | 191 ++++++++++++++++ testing/projects/cpp_nesting/__init__.py | 101 +++++++++ testing/projects/cpp_pimpl/__init__.py | 59 +++++ testing/tests/c_maths.py | 18 +- testing/tests/configs_tree_view.py | 34 ++- testing/tests/cpp_fortran_mixed.py | 37 +--- testing/tests/cpp_func_overloads.py | 60 +---- testing/tests/cpp_long_names.py | 209 ++---------------- testing/tests/cpp_nesting.py | 110 +-------- testing/tests/cpp_pimpl.py | 59 +---- testing/tests/cpp_with_spaces.py | 18 +- tox.ini | 8 +- 24 files changed, 696 insertions(+), 492 deletions(-) create mode 100644 docs/testing/projects.rst create mode 100644 testing/projects/__init__.py create mode 100644 testing/projects/c_maths/__init__.py create mode 100644 testing/projects/cpp with spaces/__init__.py create mode 100644 testing/projects/cpp_fortran_mixed/__init__.py create mode 100644 testing/projects/cpp_func_overloads/__init__.py create mode 100644 testing/projects/cpp_long_names/__init__.py create mode 100644 testing/projects/cpp_nesting/__init__.py create mode 100644 testing/projects/cpp_pimpl/__init__.py diff --git a/.github/workflows/test_python.yaml b/.github/workflows/test_python.yaml index dd387327..4fb7476c 100644 --- a/.github/workflows/test_python.yaml +++ b/.github/workflows/test_python.yaml @@ -14,16 +14,20 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-latest, ubuntu-latest, windows-latest] + # os: [macos-latest, ubuntu-latest, windows-latest] + # TODO: either obtain doxygen 1.8.20 on mac, or find out why everything + # breaks in doxygen 1.9.2. + os: [ubuntu-latest, windows-latest] steps: - uses: actions/checkout@v2 ########################################################################## - name: Install Doxygen (macOS) if: contains(matrix.os, 'macos') run: | - brew tap-new $USER/local-doxygen - brew extract --version=1.8.20 doxygen $USER/local-doxygen - HOMEBREW_NO_AUTO_UPDATE=1 brew install -v doxygen@1.8.20 + # brew tap-new $USER/local-doxygen + # brew extract --version=1.8.20 doxygen $USER/local-doxygen + # HOMEBREW_NO_AUTO_UPDATE=1 brew install -v doxygen@1.8.20 + HOMEBREW_NO_AUTO_UPDATE=1 brew install doxygen - name: Install Doxygen (Ubuntu) if: contains(matrix.os, 'ubuntu') run: | diff --git a/docs/testing.rst b/docs/testing.rst index e7d3c24b..927bc9b6 100644 --- a/docs/testing.rst +++ b/docs/testing.rst @@ -152,5 +152,6 @@ Full Testing Suite Documentation testing/decorators testing/fixtures testing/hierarchies + testing/projects testing/utils testing/tests diff --git a/docs/testing/projects.rst b/docs/testing/projects.rst new file mode 100644 index 00000000..3b9c581f --- /dev/null +++ b/docs/testing/projects.rst @@ -0,0 +1,49 @@ +Testing Projects Module +======================================================================================== + +.. automodule:: testing.projects + :members: + +`` testing.projects.c_maths`` Project +---------------------------------------------------------------------------------------- + +.. automodule:: testing.projects.c_maths + :members: + +`` testing.projects.cpp with spaces`` Project +---------------------------------------------------------------------------------------- + +.. module:: testing.projects.cpp_with_spaces + +This cannot be documented because it has spaces in the name and autodoc cannot +complete its import. + +`` testing.projects.cpp_fortran_mixed`` Project +---------------------------------------------------------------------------------------- + +.. automodule:: testing.projects.cpp_fortran_mixed + :members: + +`` testing.projects.cpp_func_overloads`` Project +---------------------------------------------------------------------------------------- + +.. automodule:: testing.projects.cpp_func_overloads + :members: + +`` testing.projects.cpp_long_names`` Project +---------------------------------------------------------------------------------------- + +.. automodule:: testing.projects.cpp_long_names + :members: + +`` testing.projects.cpp_nesting`` Project +---------------------------------------------------------------------------------------- + +.. automodule:: testing.projects.cpp_nesting + :members: + +`` testing.projects.cpp_pimpl`` Project +---------------------------------------------------------------------------------------- + +.. automodule:: testing.projects.cpp_pimpl + :members: diff --git a/docs/testproject.py b/docs/testproject.py index 365ede5d..7ffea26e 100644 --- a/docs/testproject.py +++ b/docs/testproject.py @@ -101,12 +101,16 @@ def run(self): "Example: .. testproject:: c_maths" ) self.content[0] = textwrap.dedent('''\ - View the `{project} source code here <{baseurl}/{project_dir}>`_. + The ``{project}`` test project. + + - Additional documentation: :mod:`testing.projects.{project_fixed}`. + - Source code for `{project} available here <{baseurl}/{project_dir}>`_. See also: :data:`ExhaleTestCase.test_project `. '''.format( project=self.content[0], project_dir=self.content[0].replace(" ", "\\ "), + project_fixed=self.content[0].replace(" ", "_"), # cpp with spaces project baseurl=get_projects_baseurl() )) project_node = testproject("\n".join(self.content)) diff --git a/setup.cfg b/setup.cfg index 85d94da1..bbb80c16 100644 --- a/setup.cfg +++ b/setup.cfg @@ -46,6 +46,8 @@ filterwarnings = # RemovedInSphinx30Warning: function based directive support is now deprecated. # Use class based directive instead. ignore::PendingDeprecationWarning:sphinx.util.docutils + # Any import of collections triggers this. + ignore: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working [coverage:run] data_file = .coverage diff --git a/testing/base.py b/testing/base.py index 37cbbaea..0a3d1a35 100644 --- a/testing/base.py +++ b/testing/base.py @@ -18,6 +18,7 @@ import shutil import textwrap import unittest +from importlib import import_module import exhale import pytest @@ -226,6 +227,25 @@ def test_common(self): attrs["test_common"] = test_common + # Import the default hierarchy dictionaries from the testing/projects folder + # and make it available to the class directly. + proj_mod = import_module( + "testing.projects.{test_project}".format(test_project=test_project)) + + default_class_hierarchy_dict = proj_mod.default_class_hierarchy_dict + + def class_hierarchy_wrapper(self): + return default_class_hierarchy_dict() + attrs["class_hierarchy_dict"] = class_hierarchy_wrapper + + default_file_hierarchy_dict = proj_mod.default_file_hierarchy_dict + + def file_hierarchy_wrapper(self): + return default_file_hierarchy_dict() + attrs["file_hierarchy_dict"] = file_hierarchy_wrapper + + attrs["test_project_module"] = proj_mod # In case it's ever needed... + # applying the default configuration override, which is overridden using the # @confoverride decorator at class or method level return default_confoverrides( diff --git a/testing/hierarchies.py b/testing/hierarchies.py index cde956ff..47ee18b2 100644 --- a/testing/hierarchies.py +++ b/testing/hierarchies.py @@ -26,6 +26,7 @@ import codecs import os import textwrap +from copy import deepcopy from exhale.graph import ExhaleNode from testing import get_exhale_root @@ -375,6 +376,33 @@ def __init__(self, _type, name): ######################################################################################## # Doxygen index test classes (proxies to exhale.graph.ExhaleRoot). # ######################################################################################## +def deep_copy_hierarchy_dict(spec): + """ + Produce a deep copy of the input specification of a hierarchy dictionary. + + **Parameters** + ``spec`` (:class:`python:dict`) + The input specification dictionary of the hierarchy. + + **Returns** + A copy of the dictionary with new underlying objects. + """ + def traverse_copy(t_spec): + if isinstance(t_spec, dict): + t_spec_copy = {} + for s in t_spec: + v = t_spec[s] + s_copy = deepcopy(s) + if isinstance(v, dict): + t_spec_copy[s_copy] = traverse_copy(v) + else: + t_spec_copy[s_copy] = deepcopy(v) + return t_spec_copy + else: + return deepcopy(t_spec) + return traverse_copy(spec) + + class root(object): # noqa: N801 """ Represent a class or file hierarchy to simulate an :class:`exhale.graph.ExhaleRoot`. @@ -417,7 +445,10 @@ def __init__(self, hierarchy_type, hierarchy): self.top_level = [] # Initialize from the specified hierarchy and construct the graph. - self._init_from(hierarchy) + # NOTE: a deep copy of hierarchy is needed so that if a test wants to + # examine multiple tests against the same hierarchy dict (cpp_nesting) + # the manipulations here do not alter the original nodes. + self._init_from(deep_copy_hierarchy_dict(hierarchy)) self._reparent_all() def _init_from(self, hierarchy): diff --git a/testing/projects/__init__.py b/testing/projects/__init__.py new file mode 100644 index 00000000..5bde94d4 --- /dev/null +++ b/testing/projects/__init__.py @@ -0,0 +1,3 @@ +""" +The test projects used to evaluate exhale. +""" diff --git a/testing/projects/c_maths/__init__.py b/testing/projects/c_maths/__init__.py new file mode 100644 index 00000000..fe7c46a7 --- /dev/null +++ b/testing/projects/c_maths/__init__.py @@ -0,0 +1,22 @@ +""" +The ``c_maths`` test project. +""" + +from testing.hierarchies import directory, file, function, parameters + + +def default_class_hierarchy_dict(): + """Return the default class hierarchy dictionary.""" + return {} + + +def default_file_hierarchy_dict(): + """Return the default file hierarchy dictionary.""" + return { + directory("include"): { + file("c_maths.h"): { + function("int", "cm_add"): parameters("int", "int"), + function("int", "cm_sub"): parameters("int", "int") + } + } + } diff --git a/testing/projects/cpp with spaces/__init__.py b/testing/projects/cpp with spaces/__init__.py new file mode 100644 index 00000000..31d55b49 --- /dev/null +++ b/testing/projects/cpp with spaces/__init__.py @@ -0,0 +1,25 @@ +""" +The ``cpp with spaces`` test project. +""" + +from testing.hierarchies import directory, file, function, namespace, parameters + + +def default_class_hierarchy_dict(): + """Return the default class hierarchy dictionary.""" + return {} + + +def default_file_hierarchy_dict(): + """Return the default file hierarchy dictionary.""" + return { + directory("include"): { + directory("with spaces"): { + file("with spaces.hpp"): { + namespace("with_spaces"): { + function("int", "value"): parameters() + } + } + } + } + } diff --git a/testing/projects/cpp_fortran_mixed/__init__.py b/testing/projects/cpp_fortran_mixed/__init__.py new file mode 100644 index 00000000..e890d444 --- /dev/null +++ b/testing/projects/cpp_fortran_mixed/__init__.py @@ -0,0 +1,43 @@ +""" +The ``cpp_fortran_mixed`` test project. +""" + +from testing.hierarchies import directory, file, function, namespace, parameters, variable + + +def default_class_hierarchy_dict(): + """Return the default class hierarchy dictionary.""" + return {} + + +def default_file_hierarchy_dict(): + """Return the default file hierarchy dictionary.""" + return { + directory("include"): { + directory("convert"): { + file("convert.hpp"): { + namespace("convert"): { + function("T", "to_degrees", template=["typename T"]): parameters("T"), + function("T", "to_radians", template=["typename T"]): parameters("T") + } + } + } + }, + directory("src"): { + file("conversions.f90"): { + namespace("conversions"): { + variable("real(c_float)", "pi_s"): {}, + variable("real(c_double)", "pi_d"): {}, + variable("real(c_float)", "s_180"): {}, + variable("real(c_double)", "d_180"): {}, + # NOTE: function parameters in fortran are a little weird. + # 1. has 'function', e.g. 'real(c_float) function' + # 2. Parameters are names, not types? + function("real(c_float) function", "degrees_to_radians_s"): parameters("degrees_s"), + function("real(c_double) function", "degrees_to_radians_d"): parameters("degrees_d"), + function("real(c_float) function", "radians_to_degrees_s"): parameters("radians_s"), + function("real(c_double) function", "radians_to_degrees_d"): parameters("radians_d") + } + } + } + } diff --git a/testing/projects/cpp_func_overloads/__init__.py b/testing/projects/cpp_func_overloads/__init__.py new file mode 100644 index 00000000..0463e46c --- /dev/null +++ b/testing/projects/cpp_func_overloads/__init__.py @@ -0,0 +1,68 @@ +""" +The ``cpp_func_overloads`` test project. +""" + +from testing.hierarchies import directory, file, function, namespace, parameters + + +def default_class_hierarchy_dict(): + """Return the default class hierarchy dictionary.""" + return {} + + +def default_file_hierarchy_dict(): + """Return the default file hierarchy dictionary.""" + return { + directory("include"): { + directory("overload"): { + file("overload.hpp"): { + function("int", "blargh"): parameters("int"), + namespace("overload"): { + # No args + function("void", "blargh"): parameters(), + # "pure" int overloads + function("int", "blargh"): parameters("int"), + function("int", "blargh"): parameters("int", "int"), + function("int", "blargh"): parameters("int", "int", "int"), + # "pure" float overloads + function("float", "blargh"): parameters("float"), + function("float", "blargh"): parameters("float", "float"), + function("float", "blargh"): parameters("float", "float", "float"), + # "pure" std::string overloads + function("std::string", "blargh"): parameters("const std::string&"), + function("std::string", "blargh"): parameters( + "const std::string&", "const std::string&" + ), + function("std::string", "blargh"): parameters( + "const std::string&", "const std::string&", "const std::string&" + ), + # absurd mixtures + function("std::size_t", "blargh"): parameters("std::size_t", "const std::string&"), + function("std::size_t", "blargh"): parameters( + "std::size_t", "const float&", "double", "const std::string&" + ), + # vector overloads + function("void", "blargh"): parameters("std::vector&"), + function("void", "blargh"): parameters("std::vector>&"), + # pointer style (spaces matter...) + function("void", "blargh"): parameters( + "const float *", "const float *", "float *", "std::size_t" + ), + # templates + function("C::type", "blargh", template=["class C"]): parameters("typename C::type"), + # SFINAE is really pretty yeah? + function( + "std::enable_if::value, T>::type", + "blargh", + template=["class C", "typename T"] + ): parameters("typename C::type"), + function( + "std::enable_if::value, T>::type", + "blargh", + template=["class C", "typename T"] + ): parameters("typename C::type") + } + } + } + } + } diff --git a/testing/projects/cpp_long_names/__init__.py b/testing/projects/cpp_long_names/__init__.py new file mode 100644 index 00000000..dc7e3b11 --- /dev/null +++ b/testing/projects/cpp_long_names/__init__.py @@ -0,0 +1,191 @@ +""" +The ``cpp_long_names`` test project. +""" + +import os +import platform + +from testing import TEST_PROJECTS_ROOT +from testing.hierarchies import \ + clike, define, directory, enum, file, function, namespace, parameters, typedef, \ + union, variable + + +RUN_ABSURD_TEST = platform.system() != "Windows" +""" +When ``platform.system() != "Windows"``, :data:`ABSURD_DIRECTORY_PATH` is created. +""" + + +def make_it_big(prefix): + """Mirrors the macro ``MAKE_IT_BIG`` in ``absurdly_long_names.hpp``.""" + big = [ + prefix, "that", "is", "longer", "than", "two", "hundred", "and", "fifty", + "five", "characters", "long", "which", "is", "an", "absolutely", "and", + "completely", "ridiculous", "thing", "to", "do", "and", "if", "you", "did", + "this", "in", "the", "real", "world", "you", "put", "yourself", "comfortably", + "in", "a", "position", "to", "be", "downsized", "and", "outta", "here", "as", + "soul", "position", "would", "explain", "to", "you" + ] + return "_".join(big) + + +ABSURD_DIRECTORY_PATH = os.path.abspath(os.path.join( + TEST_PROJECTS_ROOT, + "cpp_long_names", + "include", + make_it_big("directory_structure").replace("_", os.sep) +)) +""" +The absurd directory path that will be created depending on :data:`RUN_ABSURD_TEST`. +""" + + +def default_class_hierarchy_dict(): + """Return the default class hierarchy dictionary.""" + return {} + + +def default_file_hierarchy_dict(): + """ + Return the default file hierarchy dictionary. + + If :data:`RUN_ABSURD_TEST` is ``True``, :data:`ABSURD_DIRECTORY_PATH` will be + incorporated in the returned dictionary. + """ + absurdly_long_names_hpp_contents = { + define("MAKE_IT_BIG"): {}, + clike("class", make_it_big("class")): {}, + clike("struct", make_it_big("struct")): {}, + function("std::string", make_it_big("function")): parameters(), + enum(make_it_big("enum")): {}, # TODO: values("first", "second", "third"), + namespace(make_it_big("namespace")): { + variable("int", "value"): {} + }, + define(make_it_big("define").upper()): {}, + variable("int", make_it_big("variable")): {}, + typedef(make_it_big("typedef"), "float"): {}, + union(make_it_big("union")): {} + } + + if RUN_ABSURD_TEST: + absurd_directory_structure = { + directory("structure"): { + directory("that"): { + directory("is"): { + directory("longer"): { + directory("than"): { + directory("two"): { + directory("hundred"): { + directory("and"): { + directory("fifty"): { + directory("five"): { + directory("characters"): { + directory("long"): { + directory("which"): { + directory("is"): { + directory("an"): { + directory("absolutely"): { + directory("and"): { + directory("completely"): { + directory("ridiculous"): { + directory("thing"): { + directory("to"): { + directory("do"): { # noqa: E501 + directory("and"): { # noqa: E501 + directory("if"): { # noqa: E501 + directory("you"): { # noqa: E501 + directory("did"): { # noqa: E501 + directory("this"): { # noqa: E501 + directory("in"): { # noqa: E501 + directory("the"): { # noqa: E501 + directory("real"): { # noqa: E501 + directory("world"): { # noqa: E501 + directory("you"): { # noqa: E501 + directory("put"): { # noqa: E501 + directory("yourself"): { # noqa: E501 + directory("comfortably"): { # noqa: E501 + directory("in"): { # noqa: E501 + directory("a"): { # noqa: E501 + directory("position"): { # noqa: E501 + directory("to"): { # noqa: E501 + directory("be"): { # noqa: E501 + directory("downsized"): { # noqa: E501 + directory("and"): { # noqa: E501 + directory("outta"): { # noqa: E501 + directory("here"): { # noqa: E501 + directory("as"): { # noqa: E501 + directory("soul"): { # noqa: E501 + directory("position"): { # noqa: E501 + directory("would"): { # noqa: E501 + directory("explain"): { # noqa: E501 + directory("to"): { # noqa: E501 + directory("you"): { # noqa: E501 + file("a_file.hpp"): { # noqa: E501 + function("std::string", "extremely_nested"): parameters() # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } # noqa: E501 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + + return { + directory("include"): { + file("absurdly_long_names.hpp"): absurdly_long_names_hpp_contents, + directory("directory"): absurd_directory_structure + } + } + else: + return { + directory("include"): { + file("absurdly_long_names.hpp"): absurdly_long_names_hpp_contents + } + } diff --git a/testing/projects/cpp_nesting/__init__.py b/testing/projects/cpp_nesting/__init__.py new file mode 100644 index 00000000..c46a3207 --- /dev/null +++ b/testing/projects/cpp_nesting/__init__.py @@ -0,0 +1,101 @@ +""" +The ``cpp_nesting`` test project. +""" + +from testing.hierarchies import clike, directory, file, namespace, union + + +def default_class_hierarchy_dict(): + """Return the default class hierarchy dictionary.""" + return { + clike("struct", "top_level"): {}, + namespace("nested"): { + clike("struct", "one"): { + clike("struct", "params"): { + union("four_bytes"): {} + } + }, + clike("struct", "two"): { + clike("struct", "params"): { + union("four_bytes"): {} + } + }, + union("four_bytes"): {}, + namespace("dual_nested"): { + clike("struct", "one"): { + clike("struct", "params"): { + union("four_bytes"): {} + } + }, + clike("struct", "two"): { + clike("struct", "params"): { + union("four_bytes"): {} + } + } + } + } + } + + +def default_file_hierarchy_dict(): + """Return the default file hierarchy dictionary.""" + return { + directory("include"): { + file("top_level.hpp"): { + clike("struct", "top_level"): {} + }, + directory("nested"): { + directory("one"): { + file("one.hpp"): { + namespace("nested"): { + clike("struct", "one"): { + clike("struct", "params"): { + union("four_bytes"): {} + } + } + } + }, + }, + directory("two"): { + file("two.hpp"): { + namespace("nested"): { + clike("struct", "two"): { + clike("struct", "params"): { + union("four_bytes"): {} + } + }, + union("four_bytes"): {} + } + } + }, + directory("dual_nested"): { + directory("one"): { + file("one.hpp"): { + namespace("nested"): { + namespace("dual_nested"): { + clike("struct", "one"): { + clike("struct", "params"): { + union("four_bytes"): {} + } + } + } + } + } + }, + directory("two"): { + file("two.hpp"): { + namespace("nested"): { + namespace("dual_nested"): { + clike("struct", "two"): { + clike("struct", "params"): { + union("four_bytes"): {} + } + } + } + } + } + } + } + } + } + } diff --git a/testing/projects/cpp_pimpl/__init__.py b/testing/projects/cpp_pimpl/__init__.py new file mode 100644 index 00000000..53c93154 --- /dev/null +++ b/testing/projects/cpp_pimpl/__init__.py @@ -0,0 +1,59 @@ +""" +The ``cpp_pimpl`` test project. +""" + +from testing.hierarchies import clike, directory, file, namespace + + +def default_class_hierarchy_dict(): + """Return the default class hierarchy dictionary.""" + return { + namespace("pimpl"): { + clike("class", "Planet"): {}, + clike("class", "Earth"): {}, + clike("class", "EarthImpl"): {}, + clike("class", "Earth_v2"): {}, + clike("class", "Jupiter"): {}, + clike("class", "JupiterImpl"): {}, + clike("class", "Jupiter_v2"): {}, + namespace("detail"): { + clike("class", "EarthImpl"): {}, + clike("class", "JupiterImpl"): {} + } + } + } + + +def default_file_hierarchy_dict(): + """Return the default file hierarchy dictionary.""" + return { + directory("include"): { + directory("pimpl"): { + file("planet.hpp"): { + namespace("pimpl"): { + clike("class", "Planet"): {} + } + }, + file("earth.hpp"): { + namespace("pimpl"): { + clike("class", "Earth"): {}, + clike("class", "EarthImpl"): {}, + clike("class", "Earth_v2"): {}, + namespace("detail"): { + clike("class", "EarthImpl"): {} + } + } + }, + file("jupiter.hpp"): { + namespace("pimpl"): { + clike("class", "Jupiter"): {}, + clike("class", "JupiterImpl"): {}, + clike("class", "Jupiter_v2"): {}, + namespace("detail"): { + clike("class", "JupiterImpl"): {} + } + } + } + } + } + } diff --git a/testing/tests/c_maths.py b/testing/tests/c_maths.py index abe32bce..4ec7cd6c 100644 --- a/testing/tests/c_maths.py +++ b/testing/tests/c_maths.py @@ -14,9 +14,8 @@ from testing.base import ExhaleTestCase from testing.decorators import confoverrides, no_run -from testing.hierarchies import \ - class_hierarchy, compare_class_hierarchy, compare_file_hierarchy, \ - directory, file, file_hierarchy, function, parameters +from testing.hierarchies import \ + class_hierarchy, compare_class_hierarchy, compare_file_hierarchy, file_hierarchy class CMathsTests(ExhaleTestCase): @@ -36,17 +35,8 @@ def test_alt_out(self): def test_hierarchies(self): """Verify the class and file hierarchies.""" - # verify the file hierarchy and file declaration relationships - file_hierarchy_dict = { - directory("include"): { - file("c_maths.h"): { - function("int", "cm_add"): parameters("int", "int"), - function("int", "cm_sub"): parameters("int", "int") - } - } - } - compare_file_hierarchy(self, file_hierarchy(file_hierarchy_dict)) - compare_class_hierarchy(self, class_hierarchy({})) + compare_class_hierarchy(self, class_hierarchy(self.class_hierarchy_dict())) + compare_file_hierarchy(self, file_hierarchy(self.file_hierarchy_dict())) @no_run diff --git a/testing/tests/configs_tree_view.py b/testing/tests/configs_tree_view.py index 9b8aa54f..33d811d7 100644 --- a/testing/tests/configs_tree_view.py +++ b/testing/tests/configs_tree_view.py @@ -11,14 +11,14 @@ from __future__ import unicode_literals import os import re -import textwrap +from textwrap import dedent from testing.base import ExhaleTestCase from testing.decorators import confoverrides class_hierarchy_ground_truth = { - "default_rst_list": textwrap.dedent(r''' + "default_rst_list": dedent(r''' - :ref:`namespace_nested` - :ref:`namespace_nested__dual_nested` - :ref:`exhale_struct_structnested_1_1dual__nested_1_1one` @@ -36,7 +36,7 @@ - :ref:`exhale_union_unionnested_1_1four__bytes` - :ref:`exhale_struct_structtop__level` '''), - "collapsible_lists": textwrap.dedent(r''' + "collapsible_lists": dedent(r'''
    • @@ -101,7 +101,7 @@
    '''), # noqa: E501 - "bootstrap": textwrap.dedent(r''' + "bootstrap": dedent(r'''