All Tests

The tests package contains all of the test classes / functions.

Exhale Core Tests

configs

Tests for validating error handling with configs set in conf.py.

testing.tests.configs.assert_message_not_present(test, message, text, flags=0)[source]

Assert that message is found in text.

This method is useful for creating consistent error messages when a test fails, including printing out what the contents of message and text were.

Parameters

test (ExhaleTestCase)

The test case to call assertTrue with, should just be self for most test cases in the framework.

message (str)

The message to search for in text. This will be the pattern parameter for a call to re.search().

text (str)

The text to be searched. This will be the string parameter for a call to re.search().

flags (int)

Optional flags to supply as flags to re.search(). Default of 0 means no special flags sent.

testing.tests.configs.assert_message_present(test, message, text, flags=0)[source]

Assert that message is not found in text.

This method is useful for creating consistent error messages when a test fails, including printing out what the contents of message and text were.

Parameters

test (ExhaleTestCase)

The test case to call assertTrue with, should just be self for most test cases in the framework.

message (str)

The message to search for in text. This will be the pattern parameter for a call to re.search().

text (str)

The text to be searched. This will be the string parameter for a call to re.search().

flags (int)

Optional flags to supply as flags to re.search(). Default of 0 means no special flags sent.

class testing.tests.configs.ConfigurationStatusTests(methodName='runTest')[source]

Tests to ensure expected status messages are displayed.

test_project = 'cpp_nesting'

Test Project Source

View the cpp_nesting source code here. See also: ExhaleTestCase.test_project.

Note

The cpp_nesting project is just being recycled, the tests for that project take place in CPPNesting.

treeview_add_start_message = 'Exhale: adding tree view css / javascript\\.'

Start message displayed only when createTreeView is True.

treeview_add_close_message = 'Exhale: added tree view css / javascript\\.'

Closing message displayed only when createTreeView is True.

test_no_treeview()[source]

Verify no notification for adding CSS / JavaScript issued when no Tree View requested.

test_treeview()[source]

Verify notification for adding CSS / JavaScript issued when Tree View requested.

class testing.tests.configs.ConfigurationWarningTests(methodName='runTest')[source]

Tests to ensure non-fatal configuration discrepancies receive warnings.

test_project = 'cpp_nesting'

Test Project Source

View the cpp_nesting source code here. See also: ExhaleTestCase.test_project.

Note

The cpp_nesting project is just being recycled, the tests for that project take place in CPPNesting.

test_treeview_mismatch()[source]

Verify warning issued with createTreeView=False but treeViewIsBootstrap=True.

class testing.tests.configs.ListingExcludeTests(methodName='runTest')[source]

Test for expected failures when invalid configurations are given in conf.py.

test_project = 'cpp_nesting'

Test Project Source

View the cpp_nesting source code here. See also: ExhaleTestCase.test_project.

Note

The cpp_nesting project is just being recycled, the tests for that project take place in CPPNesting.

class BadStr[source]

Helper for ListingExcludeTests.test_invalid_report_index().

test_invalid_report_index()[source]

Verify list index is indicated when item cannot be converted to string.

test_invalid_regex_flags()[source]

Verify invalid regex flags are rejected.

test_bad_regex()[source]

Verify string pattern that does not compile is gracefully rejected.

test_too_many()[source]

Verify that length three item is rejected.

Only pattern:str or (pattern:str, flags:int) are allowed.

test_invalid_pattern()[source]

Verify that non-string argument for pattern is rejected.

class testing.tests.configs.UnabridgedOrphanKindsTests(methodName='runTest')[source]

Test various values of unabridgedOrphanKinds.

test_project = 'cpp_long_names'

Test Project Source

View the cpp_long_names source code here. See also: ExhaleTestCase.test_project.

The cpp_long_names project essentially has 1 compound of each kind, which makes it an ideal project to reuse here.

test_not_iterable_fails()[source]

Verify that non-list/set values raise a configuration error.

test_non_string_fails()[source]

Verify that non-string entries raise a configuration error.

test_invalid_kind()[source]

Verify that invalid kind raises a configuration error.

total(root)[source]

Count all nodes that are not enumvalue and group.

test_no_exclusion()[source]

Verify empty list means no exlusions from full API.

test_orphan_namespace()[source]

Verify excluding namespace behaves as expected.

test_orphan_class()[source]

Verify excluding class behaves as expected.

test_orphan_struct()[source]

Verify excluding struct behaves as expected.

test_orphan_class_struct()[source]

Verify excluding class and struct behaves as expected.

test_orphan_enum()[source]

Verify excluding enum behaves as expected.

test_orphan_union()[source]

Verify excluding union behaves as expected.

test_orphan_function()[source]

Verify excluding function behaves as expected.

test_orphan_variable()[source]

Verify excluding variable behaves as expected.

test_orphan_define()[source]

Verify excluding define behaves as expected.

test_orphan_typedef()[source]

Verify excluding typedef behaves as expected.

test_orphan_file()[source]

Verify excluding file behaves as expected.

configs_tree_view

Tests specifically focused on the various tree view configurations.

testing.tests.configs_tree_view.class_hierarchy_ground_truth = {'bootstrap': '\n<div id="class-treeView"></div>\n<script type="text/javascript">\nfunction getClassHierarchyTree() {\n return [\n {\n text: "<span class=\\"text-muted\\">Namespace</span> nested",\n href: "namespace_nested.html#namespace-nested",\n selectable: false,\n tags: [\'4\'],\n\n nodes: [\n {\n text: "<span class=\\"text-muted\\">Namespace</span> nested::dual_nested",\n href: "namespace_nested__dual_nested.html#namespace-nested-dual-nested",\n selectable: false,\n tags: [\'2\'],\n\n nodes: [\n {\n text: "<span class=\\"text-muted\\">Struct</span> one",\n href: "structnested_1_1dual__nested_1_1one.html#exhale-struct-structnested-1-1dual-nested-1-1one",\n selectable: false,\n tags: [\'1\'],\n\n nodes: [\n {\n text: "<span class=\\"text-muted\\">Struct</span> one::params",\n href: "structnested_1_1dual__nested_1_1one_1_1params.html#exhale-struct-structnested-1-1dual-nested-1-1one-1-1params",\n selectable: false,\n tags: [\'1\'],\n\n nodes: [\n {\n text: "<span class=\\"text-muted\\">Union</span> params::four_bytes",\n href: "unionnested_1_1dual__nested_1_1one_1_1params_1_1four__bytes.html#exhale-union-unionnested-1-1dual-nested-1-1one-1-1params-1-1four-bytes",\n selectable: false,\n },\n ]\n },\n ]\n },\n {\n text: "<span class=\\"text-muted\\">Struct</span> two",\n href: "structnested_1_1dual__nested_1_1two.html#exhale-struct-structnested-1-1dual-nested-1-1two",\n selectable: false,\n tags: [\'1\'],\n\n nodes: [\n {\n text: "<span class=\\"text-muted\\">Struct</span> two::params",\n href: "structnested_1_1dual__nested_1_1two_1_1params.html#exhale-struct-structnested-1-1dual-nested-1-1two-1-1params",\n selectable: false,\n tags: [\'1\'],\n\n nodes: [\n {\n text: "<span class=\\"text-muted\\">Union</span> params::four_bytes",\n href: "unionnested_1_1dual__nested_1_1two_1_1params_1_1four__bytes.html#exhale-union-unionnested-1-1dual-nested-1-1two-1-1params-1-1four-bytes",\n selectable: false,\n },\n ]\n },\n ]\n },\n ]\n },\n {\n text: "<span class=\\"text-muted\\">Struct</span> one",\n href: "structnested_1_1one.html#exhale-struct-structnested-1-1one",\n selectable: false,\n tags: [\'1\'],\n\n nodes: [\n {\n text: "<span class=\\"text-muted\\">Struct</span> one::params",\n href: "structnested_1_1one_1_1params.html#exhale-struct-structnested-1-1one-1-1params",\n selectable: false,\n tags: [\'1\'],\n\n nodes: [\n {\n text: "<span class=\\"text-muted\\">Union</span> params::four_bytes",\n href: "unionnested_1_1one_1_1params_1_1four__bytes.html#exhale-union-unionnested-1-1one-1-1params-1-1four-bytes",\n selectable: false,\n },\n ]\n },\n ]\n },\n {\n text: "<span class=\\"text-muted\\">Struct</span> two",\n href: "structnested_1_1two.html#exhale-struct-structnested-1-1two",\n selectable: false,\n tags: [\'1\'],\n\n nodes: [\n {\n text: "<span class=\\"text-muted\\">Struct</span> two::params",\n href: "structnested_1_1two_1_1params.html#exhale-struct-structnested-1-1two-1-1params",\n selectable: false,\n tags: [\'1\'],\n\n nodes: [\n {\n text: "<span class=\\"text-muted\\">Union</span> params::four_bytes",\n href: "unionnested_1_1two_1_1params_1_1four__bytes.html#exhale-union-unionnested-1-1two-1-1params-1-1four-bytes",\n selectable: false,\n },\n ]\n },\n ]\n },\n {\n text: "<span class=\\"text-muted\\">Union</span> four_bytes",\n href: "unionnested_1_1four__bytes.html#exhale-union-unionnested-1-1four-bytes",\n selectable: false,\n },\n ]\n },\n {\n text: "<span class=\\"text-muted\\">Struct</span> top_level",\n href: "structtop__level.html#exhale-struct-structtop-level",\n selectable: false,\n },\n\n ]\n}\n</script><!-- end getClassHierarchyTree() function -->\n', 'collapsible_lists': '\n<ul class="treeView" id="class-treeView">\n<li>\n <ul class="collapsibleList">\n <li>\n Namespace <a href="namespace_nested.html#namespace-nested">nested</a>\n <ul>\n <li>\n Namespace <a href="namespace_nested__dual_nested.html#namespace-nested-dual-nested">nested::dual_nested</a>\n <ul>\n <li>\n Struct <a href="structnested_1_1dual__nested_1_1one.html#exhale-struct-structnested-1-1dual-nested-1-1one">one</a>\n <ul>\n <li class="lastChild">\n Struct <a href="structnested_1_1dual__nested_1_1one_1_1params.html#exhale-struct-structnested-1-1dual-nested-1-1one-1-1params">one::params</a>\n <ul>\n <li class="lastChild">Union <a href="unionnested_1_1dual__nested_1_1one_1_1params_1_1four__bytes.html#exhale-union-unionnested-1-1dual-nested-1-1one-1-1params-1-1four-bytes">params::four_bytes</a></li>\n </ul>\n </li>\n </ul>\n </li>\n <li class="lastChild">\n Struct <a href="structnested_1_1dual__nested_1_1two.html#exhale-struct-structnested-1-1dual-nested-1-1two">two</a>\n <ul>\n <li class="lastChild">\n Struct <a href="structnested_1_1dual__nested_1_1two_1_1params.html#exhale-struct-structnested-1-1dual-nested-1-1two-1-1params">two::params</a>\n <ul>\n <li class="lastChild">Union <a href="unionnested_1_1dual__nested_1_1two_1_1params_1_1four__bytes.html#exhale-union-unionnested-1-1dual-nested-1-1two-1-1params-1-1four-bytes">params::four_bytes</a></li>\n </ul>\n </li>\n </ul>\n </li>\n </ul>\n </li>\n <li>\n Struct <a href="structnested_1_1one.html#exhale-struct-structnested-1-1one">one</a>\n <ul>\n <li class="lastChild">\n Struct <a href="structnested_1_1one_1_1params.html#exhale-struct-structnested-1-1one-1-1params">one::params</a>\n <ul>\n <li class="lastChild">Union <a href="unionnested_1_1one_1_1params_1_1four__bytes.html#exhale-union-unionnested-1-1one-1-1params-1-1four-bytes">params::four_bytes</a></li>\n </ul>\n </li>\n </ul>\n </li>\n <li>\n Struct <a href="structnested_1_1two.html#exhale-struct-structnested-1-1two">two</a>\n <ul>\n <li class="lastChild">\n Struct <a href="structnested_1_1two_1_1params.html#exhale-struct-structnested-1-1two-1-1params">two::params</a>\n <ul>\n <li class="lastChild">Union <a href="unionnested_1_1two_1_1params_1_1four__bytes.html#exhale-union-unionnested-1-1two-1-1params-1-1four-bytes">params::four_bytes</a></li>\n </ul>\n </li>\n </ul>\n </li>\n <li class="lastChild">Union <a href="unionnested_1_1four__bytes.html#exhale-union-unionnested-1-1four-bytes">four_bytes</a></li>\n </ul>\n </li>\n <li class="lastChild">Struct <a href="structtop__level.html#exhale-struct-structtop-level">top_level</a></li>\n\n </ul>\n</li><!-- only tree view element -->\n</ul><!-- /treeView class-treeView -->\n', 'default_rst_list': '\n- :ref:`namespace_nested`\n - :ref:`namespace_nested__dual_nested`\n - :ref:`exhale_struct_structnested_1_1dual__nested_1_1one`\n - :ref:`exhale_struct_structnested_1_1dual__nested_1_1one_1_1params`\n - :ref:`exhale_union_unionnested_1_1dual__nested_1_1one_1_1params_1_1four__bytes`\n - :ref:`exhale_struct_structnested_1_1dual__nested_1_1two`\n - :ref:`exhale_struct_structnested_1_1dual__nested_1_1two_1_1params`\n - :ref:`exhale_union_unionnested_1_1dual__nested_1_1two_1_1params_1_1four__bytes`\n - :ref:`exhale_struct_structnested_1_1one`\n - :ref:`exhale_struct_structnested_1_1one_1_1params`\n - :ref:`exhale_union_unionnested_1_1one_1_1params_1_1four__bytes`\n - :ref:`exhale_struct_structnested_1_1two`\n - :ref:`exhale_struct_structnested_1_1two_1_1params`\n - :ref:`exhale_union_unionnested_1_1two_1_1params_1_1four__bytes`\n - :ref:`exhale_union_unionnested_1_1four__bytes`\n- :ref:`exhale_struct_structtop__level`\n'}

Ground truth for the three versions of class hierarchies.

Keys and what they represent:

"default_rst_list"

The reStructuredText list version (createTreeView=False).

"collapsible_lists"

The collapsible lists version of the tree view (raw html unordered list).

"bootstrap"

The bootstrap version of the tree view (raw JavaScript function returning json data).

Todo

This will break if / when doxygen refid generation changes. In theory it should be possible to synthetically re-create the hierarchy without this crazy text processing.

testing.tests.configs_tree_view.file_hierarchy_ground_truth = {'bootstrap': '\n<div id="file-treeView"></div>\n<script type="text/javascript">\nfunction getFileHierarchyTree() {\n return [\n {\n text: "<span class=\\"text-muted\\">Directory</span> include",\n href: "dir_include.html#dir-include",\n selectable: false,\n tags: [\'2\'],\n\n nodes: [\n {\n text: "<span class=\\"text-muted\\">Directory</span> nested",\n href: "dir_include_nested.html#dir-include-nested",\n selectable: false,\n tags: [\'3\'],\n\n nodes: [\n {\n text: "<span class=\\"text-muted\\">Directory</span> nested",\n href: "dir_include_nested_dual_nested.html#dir-include-nested-dual-nested",\n selectable: false,\n tags: [\'2\'],\n\n nodes: [\n {\n text: "<span class=\\"text-muted\\">Directory</span> one",\n href: "dir_include_nested_dual_nested_one.html#dir-include-nested-dual-nested-one",\n selectable: false,\n tags: [\'1\'],\n\n nodes: [\n {\n text: "<span class=\\"text-muted\\">File</span> one.hpp",\n href: "file_include_nested_dual_nested_one_one.hpp.html#file-include-nested-dual-nested-one-one.hpp",\n selectable: false,\n },\n ]\n },\n {\n text: "<span class=\\"text-muted\\">Directory</span> two",\n href: "dir_include_nested_dual_nested_two.html#dir-include-nested-dual-nested-two",\n selectable: false,\n tags: [\'1\'],\n\n nodes: [\n {\n text: "<span class=\\"text-muted\\">File</span> two.hpp",\n href: "file_include_nested_dual_nested_two_two.hpp.html#file-include-nested-dual-nested-two-two.hpp",\n selectable: false,\n },\n ]\n },\n ]\n },\n {\n text: "<span class=\\"text-muted\\">Directory</span> one",\n href: "dir_include_nested_one.html#dir-include-nested-one",\n selectable: false,\n tags: [\'1\'],\n\n nodes: [\n {\n text: "<span class=\\"text-muted\\">File</span> one.hpp",\n href: "file_include_nested_one_one.hpp.html#file-include-nested-one-one.hpp",\n selectable: false,\n },\n ]\n },\n {\n text: "<span class=\\"text-muted\\">Directory</span> two",\n href: "dir_include_nested_two.html#dir-include-nested-two",\n selectable: false,\n tags: [\'1\'],\n\n nodes: [\n {\n text: "<span class=\\"text-muted\\">File</span> two.hpp",\n href: "file_include_nested_two_two.hpp.html#file-include-nested-two-two.hpp",\n selectable: false,\n },\n ]\n },\n ]\n },\n {\n text: "<span class=\\"text-muted\\">File</span> top_level.hpp",\n href: "file_include_top_level.hpp.html#file-include-top-level.hpp",\n selectable: false,\n },\n ]\n },\n\n ]\n}\n</script><!-- end getFileHierarchyTree() function -->\n', 'collapsible_lists': '\n<ul class="treeView" id="file-treeView">\n<li>\n <ul class="collapsibleList">\n <li class="lastChild">\n Directory <a href="dir_include.html#dir-include">include</a>\n <ul>\n <li>\n Directory <a href="dir_include_nested.html#dir-include-nested">nested</a>\n <ul>\n <li>\n Directory <a href="dir_include_nested_dual_nested.html#dir-include-nested-dual-nested">nested</a>\n <ul>\n <li>\n Directory <a href="dir_include_nested_dual_nested_one.html#dir-include-nested-dual-nested-one">one</a>\n <ul>\n <li class="lastChild">File <a href="file_include_nested_dual_nested_one_one.hpp.html#file-include-nested-dual-nested-one-one.hpp">one.hpp</a></li>\n </ul>\n </li>\n <li class="lastChild">\n Directory <a href="dir_include_nested_dual_nested_two.html#dir-include-nested-dual-nested-two">two</a>\n <ul>\n <li class="lastChild">File <a href="file_include_nested_dual_nested_two_two.hpp.html#file-include-nested-dual-nested-two-two.hpp">two.hpp</a></li>\n </ul>\n </li>\n </ul>\n </li>\n <li>\n Directory <a href="dir_include_nested_one.html#dir-include-nested-one">one</a>\n <ul>\n <li class="lastChild">File <a href="file_include_nested_one_one.hpp.html#file-include-nested-one-one.hpp">one.hpp</a></li>\n </ul>\n </li>\n <li class="lastChild">\n Directory <a href="dir_include_nested_two.html#dir-include-nested-two">two</a>\n <ul>\n <li class="lastChild">File <a href="file_include_nested_two_two.hpp.html#file-include-nested-two-two.hpp">two.hpp</a></li>\n </ul>\n </li>\n </ul>\n </li>\n <li class="lastChild">File <a href="file_include_top_level.hpp.html#file-include-top-level.hpp">top_level.hpp</a></li>\n </ul>\n </li>\n\n </ul>\n</li><!-- only tree view element -->\n</ul><!-- /treeView file-treeView -->\n', 'default_rst_list': '\n- :ref:`dir_include`\n - :ref:`dir_include_nested`\n - :ref:`dir_include_nested_dual_nested`\n - :ref:`dir_include_nested_dual_nested_one`\n - :ref:`file_include_nested_dual_nested_one_one.hpp`\n - :ref:`dir_include_nested_dual_nested_two`\n - :ref:`file_include_nested_dual_nested_two_two.hpp`\n - :ref:`dir_include_nested_one`\n - :ref:`file_include_nested_one_one.hpp`\n - :ref:`dir_include_nested_two`\n - :ref:`file_include_nested_two_two.hpp`\n - :ref:`file_include_top_level.hpp`\n'}

Ground truth for the three versions of file hierarchies.

Keys and what they represent:

"default_rst_list"

The reStructuredText list version (createTreeView=False).

"collapsible_lists"

The collapsible lists version of the tree view (raw html unordered list).

"bootstrap"

The bootstrap version of the tree view (raw JavaScript function returning json data).

Todo

This one should be possible to re-create manually rather than relying on direct text comparisons. But until you figure out how to do the class one more programmatically you aren’t doing that lolz.

class testing.tests.configs_tree_view.TreeViewHierarchyTests(methodName='runTest')[source]

Naive tests on raw “reStructuredText” generated for tree views.

test_project = 'cpp_nesting'

Test Project Source

View the cpp_nesting source code here. See also: ExhaleTestCase.test_project.

Note

The cpp_nesting project is just being recycled, the tests for that project take place in CPPNesting.

class_view_hierarchy_file()[source]

Path to class_view_hierarchy.rst for this test.

file_view_hierarchy_file()[source]

Path to file_view_hierarchy.rst for this test.

raw_hierarchies()[source]

Raw contents of class_view_hierarchy.rst and file_view_hierarchy.rst.

Return (Length 2 tuple of str)

The string contents of (class_view, file_view), in that order.

filter_empty_lines(lst)[source]

Return a copy of lst with empty / whitespace-only strings removed.

Parameters
lst (list of str)

The input list of strings to filter.

Return (list of str)

The input lst in the same order, with empty strings and whitespace-only strings removed.

html_hierarchies()[source]

Hierarchy text from class_view_hierarchy.rst and file_view_hierarchy.rst.

When createTreeView=True, the generated page has something like:

Class View Hierarchy
--------------------

.. raw:: html

   <ul>
     <li> ... </li>
     <!-- ... -->
     <li> ... </li>
   </ul>

.. end raw html for treeView

What this method does is simply search for .. raw:: html and .. end respectively, accumulating everything in between. Since we are performing direct string comparisons with “ground truth” values, we specifically accumulate line.strip() to remove the leading indentation since it is under a .. raw:: html directive. Finally, the returned output is filtered using filter_empty_lines().

Return (Length 2 tuple of list of str)

A length two tuple in the order (class_view, file_view). Each item in the tuple is a list of strings of the parsed / filtered lines.

line_compare(expected_list, test_list)[source]

Compare two lists of strings.

Performs two tests:

  1. That len(expected_list) and len(test_list) are the same.

  2. That the order and values of strings in expected_list are the same as test_list. Mismatched values will be printed in the assertion.

Parameters
expected_list (list of str)

The expected list of strings to compare with.

test_list (list of str)

The parsed list of strings to validate.

line_compare_minified(expected_list, test_list, bootstrap=False)[source]

Compare two lists of tree view strings.

This responsible expects the same input as line_compare(), but does some additional processing on the expected_list. To explain, let’s take a look at the lines involved in the actual minified output:

Index

Collapsible Lists (HTML Unordered List)

Bootstrap Version (JavaScript Function Returning JSON)

0

<ul class="treeView" id="class-treeView">

<script type="text/javascript">

1

<li>

function getClassHierarchyTree() {

2

<ul class="collapsibleList">

return [

3

<<< really long >>>

<<< really long >>>

4

</ul>

]

5

</li><!-- only tree view element -->

}

6

</ul><!-- /treeView class-treeView -->

</script><!-- end getClassHierarchyTree() function --></div>

By convenience and design, line 3 is really the thing we want to test, because that is the meat of the tree view. For completeness indices [0,3) and [4,6] are also validated, but constructing line 3 from the provided expected_list (the non-minified ground truth) is the focus of this test function.

Parameters
expected_list (list of str)

The expected list of strings to compare with.

test_list (list of str)

The parsed list of strings to validate.

bootstrap (bool)

If False, test is a Collapsible Lists test. If True, test is a Bootstrap test.

html_ground_truth_list(hierarchy, key)[source]

Ground truth data for html-based validation tests.

Parameters
hierarchy (str)

Should only be "class" or "file". Indexes into class_hierarchy_ground_truth and file_hierarchy_ground_truth respectively.

key (str)

The key to lookup in either class_hierarchy_ground_truth or file_hierarchy_ground_truth. Specifically, you really only want to be using "collapsible_lists" or "bootstrap", since the raw reStructuredText version (createTreeView=False) can be compared directly.

Return (list of str)

The text specified by hierarchy[key], with every line split and lines filtered by filter_empty_lines().

test_no_custom_html()[source]

Verify the default reStructuredText list appears as expected.

test_collapsible_lists()[source]

Verify the un-minified collapsible lists html unordered list appears as expected.

test_collapsible_lists_minified()[source]

Verify the minified collapsible lists html unordered list appears as expected.

test_bootstrap()[source]

Verify the un-minified bootstrap json data list appears as expected.

test_bootstrap_minified()[source]

Verify the minified bootstrap json data list appears as expected.

Project Tests

c_maths

Tests for the c_maths project.

class testing.tests.c_maths.CMathsTests(methodName='runTest')[source]

Primary test class for project c_maths.

test_project = 'c_maths'

Test Project Source

View the c_maths source code here. See also: ExhaleTestCase.test_project.

test_alt_out()[source]

Test "./alt_api" rather than default "./api" as "containmentFolder".

test_hierarchies()[source]

Verify the class and file hierarchies.

class testing.tests.c_maths.CMathsTestsNoRun(methodName='runTest')[source]

Secondary test case for project c_maths.

A testing.decorators.no_run() decorated test class.

test_project = 'c_maths'

Test Project Source

View the c_maths source code here. See also: ExhaleTestCase.test_project.

test_classwide_no_run()[source]

Verify that the default "./api" folder is indeed not generated.

cpp_fortran_mixed

Tests for the cpp_fortran_mixed project.

class testing.tests.cpp_fortran_mixed.CPPFortranMixed(methodName='runTest')[source]

Primary test class for project cpp_fortran_mixed.

This test class exists to test explicit language lexer mappings via lexerMapping. Note that the C++ code and namespace convert is definitively chosen to be different than the name of the fortran module name (conversions). If they are the same, some interesting things happen on the Doxygen side, because Doxygen will combine the namespaces.

Todo

These tests are incomplete (from __future__ import config_objects). The module level storage creates conflicts between the test cases when specifying the regular expressions :/

Currently there is only one test for a custom lexer mapping, and it only actually works because the name is alphabetically sorted after the default test (meaning pytest will run it after).

Todo

The full function validation does not support templates (yet). Templates at large in the testing framework need to be reworked, currently it is all boiler plate code with no actual validation…

test_project = 'cpp_fortran_mixed'

Test Project Source

View the cpp_fortran_mixed source code here. See also: ExhaleTestCase.test_project.

file_hierarchy_dict = {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.file object>: {<testing.hierarchies.namespace object>: {<testing.hierarchies.function object>: <testing.hierarchies.parameters object>, <testing.hierarchies.function object>: <testing.hierarchies.parameters object>}}}}, <testing.hierarchies.directory object>: {<testing.hierarchies.file object>: {<testing.hierarchies.namespace object>: {<testing.hierarchies.function object>: <testing.hierarchies.parameters object>, <testing.hierarchies.function object>: <testing.hierarchies.parameters object>, <testing.hierarchies.function object>: <testing.hierarchies.parameters object>, <testing.hierarchies.function object>: <testing.hierarchies.parameters object>, <testing.hierarchies.variable object>: {}, <testing.hierarchies.variable object>: {}, <testing.hierarchies.variable object>: {}, <testing.hierarchies.variable object>: {}}}}}

The file hierarchy for this project.

test_hierarchies()[source]

Validate the class and file hierarchies.

Not tested on Windows, maybe I’ll care to fix it one day. But it is not this day!

Todo

Too much shared code in hierarchy comparisons, the class hierarchy for this project should be empty. Need to enable asserting this fact (same for the cpp_nesting project).

validate_pygments_lexers(exhale_root, node_map)[source]

Validate nodes have the expected pygments lexer in their program listing file.

Parameters

exhale_root (exhale.graph.ExhaleRoot)

The graph root object for this project.

node_map (dict)

A map of exhale.graph.ExhaleNode objects to string values. The keys must be the nodes extracted from the exhale_root (as opposed to a testing type). Each value should be a pygments lexer, such as "cpp" or "fortran".

The generated program listing file will be parsed and an assert statement performed for equality to these specified values.

get_hpp_and_f90_nodes(exhale_root)[source]

Return the two ExhaleNode objects for this project.

Parameters

exhale_root (ExhaleRoot)

The graph root object for this project.

Returns

tuple

A length two tuple of ExhaleNode objects, ordered as (convert_hpp, conversions_f90). These represent the files include/convert/convert.hpp and src/conversions.f90, respectively.

test_default_lexers()[source]

Verify convert.hpp maps to "cpp" and conversions.f90 to "fortran".

test_modified_fortran()[source]

Verify regular expression overload of *.f90 files map to "python".

cpp_long_names

Tests for the cpp_long_names project.

testing.tests.cpp_long_names.RUN_ABSURD_TEST = True

When platform.system() != "Windows", ABSURD_DIRECTORY_PATH is created.

testing.tests.cpp_long_names.make_it_big(prefix)[source]

Mirrors the macro MAKE_IT_BIG in absurdly_long_names.hpp.

testing.tests.cpp_long_names.ABSURD_DIRECTORY_PATH = '/home/docs/checkouts/readthedocs.org/user_builds/exhale/checkouts/1.x/testing/projects/cpp_long_names/include/directory/structure/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'

The absurd directory path that will be created depending on RUN_ABSURD_TEST.

testing.tests.cpp_long_names.make_file_hierarchy_dict()[source]

Return the dict representing the file hierarchy.

If RUN_ABSURD_TEST is True, ABSURD_DIRECTORY_PATH will be incorporated in the returned dictionary.

testing.tests.cpp_long_names.create_absurd_directory_structure()[source]

Create the absurd directory structure when RUN_ABSURD_TEST is True.

Helper function for the testing fixture potentially_with_insanity_fixture().

testing.tests.cpp_long_names.remove_absurd_directory_structure()[source]

Remove the absurd directory structure when RUN_ABSURD_TEST is True.

Helper function for the testing fixture potentially_with_insanity_fixture().

testing.tests.cpp_long_names.potentially_with_insanity_fixture()[source]

Class-level fixture that may create / remove the absurd directory.

This will create the absurd directory structure before any tests are run, and remove it when all are finished when RUN_ABSURD_TEST is True.

testing.tests.cpp_long_names.potentially_with_insanity(cls)[source]

Mark cls to use the fixture potentially_with_insanity().

Parameters

cls (CPPLongNames)

Decorator designed only for CPPLongNames.

Return (CPPLongNames)

The input cls, after executing pytest.mark.usefixtures.

class testing.tests.cpp_long_names.CPPLongNames(methodName='runTest')[source]

Primary test class for project cpp_long_names.

test_project = 'cpp_long_names'

Test Project Source

View the cpp_long_names source code here. See also: ExhaleTestCase.test_project.

file_hierarchy_dict = {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.file object>: {<testing.hierarchies.function object>: <testing.hierarchies.parameters object>}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}, <testing.hierarchies.file object>: {<testing.hierarchies.define object>: {}, <testing.hierarchies.enum object>: {}, <testing.hierarchies.function object>: <testing.hierarchies.parameters object>, <testing.hierarchies.namespace object>: {<testing.hierarchies.variable object>: {}}, <testing.hierarchies.clike object>: {}, <testing.hierarchies.clike object>: {}, <testing.hierarchies.define object>: {}, <testing.hierarchies.typedef object>: {}, <testing.hierarchies.union object>: {}, <testing.hierarchies.variable object>: {}}}}

The (potentially absurd) file hierarchy for this project.

test_hashes()[source]

Verify the long names get hashed to the expected values.

test_file_hierarchy()[source]

Verify the file hierarchy.

The class hierarchy is not validated for this test project simply because doing so is rather pointless, and the added complexity to do so given the conditionally created structure is not worth the effort.

cpp_nesting

Tests for the cpp_nesting project.

class testing.tests.cpp_nesting.CPPNesting(methodName='runTest')[source]

Primary test class for project cpp_nesting.

test_project = 'cpp_nesting'

Test Project Source

View the cpp_nesting source code here. See also: ExhaleTestCase.test_project.

test_hierarchies()[source]

Verify the class and file hierarchies.

test_hierarchies_stripped()[source]

Verify the class and file hierarchies with doxygenStripFromPath=../include.

Todo

this test is not supported yet

cpp_pimpl

Tests for the cpp_nesting project.

class testing.tests.cpp_pimpl.TestedExclusionTypes[source]

An “enum” for listing exclusions we care about.

Yes, I still need to support python 2.

NoExclusions = 0

No exclusions were requested.

AllImpl = 1

All r".*Impl$" should be excluded.

DetailImpl = 2

Only r".*detail::.*Impl$" should be excluded.

class testing.tests.cpp_pimpl.CPPPimpl(methodName='runTest')[source]

Primary test class for project cpp_pimpl.

test_project = 'cpp_pimpl'

Test Project Source

View the cpp_pimpl source code here. See also: ExhaleTestCase.test_project.

file_hierarchy_dict = {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.file object>: {<testing.hierarchies.namespace object>: {<testing.hierarchies.clike object>: {}, <testing.hierarchies.clike object>: {}, <testing.hierarchies.clike object>: {}, <testing.hierarchies.namespace object>: {<testing.hierarchies.clike object>: {}}}}, <testing.hierarchies.file object>: {<testing.hierarchies.namespace object>: {<testing.hierarchies.clike object>: {}, <testing.hierarchies.clike object>: {}, <testing.hierarchies.clike object>: {}, <testing.hierarchies.namespace object>: {<testing.hierarchies.clike object>: {}}}}, <testing.hierarchies.file object>: {<testing.hierarchies.namespace object>: {<testing.hierarchies.clike object>: {}}}}}}

The file hierarchy for this test.

class_hierarchy_dict = {<testing.hierarchies.namespace object>: {<testing.hierarchies.clike object>: {}, <testing.hierarchies.clike object>: {}, <testing.hierarchies.clike object>: {}, <testing.hierarchies.clike object>: {}, <testing.hierarchies.clike object>: {}, <testing.hierarchies.clike object>: {}, <testing.hierarchies.clike object>: {}, <testing.hierarchies.namespace object>: {<testing.hierarchies.clike object>: {}, <testing.hierarchies.clike object>: {}}}}

The class hierarchy for this test.

Link names for pimpl::{Earth,Jupiter}Impl.

Link names for pimpl::detail::{Earth,Jupiter}Impl.

Link names for earth.hpp.

Link names for jupiter.hpp.

Link names for namespace pimpl.

Link names for namespace pimpl::detail.

Return a dictionary suitable for using with str.format.

Since Doxygen will behave differently on different platforms with respect to what the specific refid of a given node is, which affect the generated link_name for a given ExhaleNode, they must be searched for after exhale runs for the given test function.

Return (dict)

A dictionary with string keys and string values is returned, the key-value pairs are {name}: {compound.link_name}:

Key

C++ Compound link_name

"pimpl"

namespace pimpl

"pimpl_detail"

namespace detail::pimpl

"pimpl_detail_EarthImpl"

class pimpl::detail::EarthImpl

"pimpl_detail_JupiterImpl"

class pimpl::detail::JupiterImpl

"pimpl_Earth"

class pimpl::Earth

"pimpl_Earth_v2"

class pimpl::Earth_v2

"pimpl_EarthImpl"

class pimpl::EarthImpl

"pimpl_Jupiter"

class pimpl::Jupiter

"pimpl_Jupiter_v2"

class pimpl::Jupiter_v2

"pimpl_JupiterImpl"

class pimpl::JupiterImpl

"pimpl_Planet"

class pimpl::Planet

expected_class_hierarchy(exclusions)[source]

Return expected rst class hiearchy listing based on specified exclusions.

Helper method for validate_class_hierarchy().

Parameters

exclusions (TestedExclusionTypes)

The exclusion that is currently being tested.

Return (str)

The expected rst class listing. If exclusions is invalid, then the string "INTERNAL TESTING ERROR" is returned.

validate_class_hierarchy(exclusions)[source]

Validate generated class hierarchy rst list is correct based on exclusions.

Parameters

exclusions (TestedExclusionTypes)

The exclusion that is currently being tested.

validate_namespace_listings(exclusions)[source]

Validate generated namespace rst listings are correct based on exclusions.

This project contains two namespaces that are tested: namespace pimpl and namespace pimpl::detail.

Parameters

exclusions (TestedExclusionTypes)

The exclusion that is currently being tested.

validate_file_listings()[source]

Validate {earth,jupiter}.hpp link to all items (regardless of "listingExclude").

test_hierarchies()[source]

Verify the class and file hierarchies.

test_no_listing_exclusions()[source]

Verify empty listing exclude results in no change in listed API.

test_impl_exclude()[source]

Verify r".*Impl$" excludes *Impl class names.

test_impl_exclude_ignorecase()[source]

Verify r".*impl$ with re.IGNORECASE excludes *Impl items.

test_detail_impl_exclude()[source]

Verify r".*detail::.*Impl$ excludes *detail::*Impl items.

test_detail_impl_exclude_ignorecase()[source]

Verify r".*detail::.*impl$ with re.IGNORECASE excludes *detail::*Impl items.

cpp with spaces

Tests for the cpp_with_spaces project.

class testing.tests.cpp_with_spaces.CPPWithSpaces(methodName='runTest')[source]

Primary test class for project cpp with spaces.

test_project = 'cpp with spaces'

Test Project Source

View the cpp with spaces source code here. See also: ExhaleTestCase.test_project.

file_hierarchy_dict = {<testing.hierarchies.directory object>: {<testing.hierarchies.directory object>: {<testing.hierarchies.file object>: {<testing.hierarchies.namespace object>: {<testing.hierarchies.function object>: <testing.hierarchies.parameters object>}}}}}

The file hierarchy for this project.

test_hierarchies()[source]

Verify the class and file hierarchies.

Todo

Class hierarchy not tested here, need to revisit that part of the testing framework as well as stop emitting a “Class Hierarchy” on the root api page when it is empty.