Skip to content

Add unit tests for functional module

Nicolas Gensollen requested to merge add-unit-tests-for-functional-module-2 into v2

What does the code in the MR do ?

Similar to !98 (merged) this MR proposes to add some unit tests for parts of code introduced in !97 (merged)

More precisely, this MR proposes to do first some refactoring of the new functional module leaspy.utils.functional. The refactoring is only re-organizing things in different files and exposing only what is necessary. There shouldn't be any functional changes.

Some functions originally defined in the functional were moved to the weighted_tensor module as they better fit within that space imo. As a consequence, I also refactored a bit the weighted_tensor module, mostly splitting things in different files. All these internal modules start with an _ to indicate that they are considered "private". The public functions and classes are exposed in the __init__.py file and were also added to the API documentation. I also added a condition in the CI script which checks that the documentation rst files match the python modules: modules starting with _ are excluded from this check as we don't want to expose them to users.

Finally, this MR adds unit tests for the different functionalities originally implemented in the functional module.

Where should the reviewer start ?

The reviewer can start by taking a look at the structural changes made to the functional and weighted_tensor module.

The unit tests can then be analyzed but should be pretty straightforward to review.

How can the code be tested ?

By running the unit tests for the functional and weighted_tensor module:

$ pytest -v --pdb tests/unit_tests/utils/functional
$ pytest -v --pdb tests/unit_tests/utils/weighted_tensor

When is the MR due for? (review deadline)

No date.

What issues are linked to the MR ?

No issue.

Edited by Nicolas Gensollen

Merge request reports