-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1386 from pints-team/func-test-organising
Re-organisation/tidying of functional tests submodule
- Loading branch information
Showing
28 changed files
with
1,526 additions
and
1,189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,43 @@ | ||
# | ||
# "Functional test" module for PINTS. | ||
# | ||
# This file is part of PINTS (https://github.com/pints-team/pints/) which is | ||
# released under the BSD 3-clause license. See accompanying LICENSE.md for | ||
# copyright notice and full license details. | ||
# | ||
|
||
from .differential_evolution import test_differential_evolution_on_banana | ||
from .differential_evolution import test_differential_evolution_on_two_dim_gaussian | ||
# Import all problem classes straight into this module, so that they can be | ||
# addressed as e.g. pints.functionaltests.RunMcmcMethodOnAnnulus. | ||
from ._problems import ( # noqa | ||
RunMcmcMethodOnAnnulus, | ||
RunMcmcMethodOnBanana, | ||
RunMcmcMethodOnCone, | ||
RunMcmcMethodOnCorrelatedGaussian, | ||
RunMcmcMethodOnHighDimensionalGaussian, | ||
RunMcmcMethodOnMultimodalGaussian, | ||
RunMcmcMethodOnTwoDimGaussian, | ||
) | ||
|
||
# Import all test modules (not methods!) directly into this method, so that | ||
# they can be addressed as e.g. | ||
# pints.functionaltests.dram_acmc.two_dim_gaussian(). | ||
from . import ( # noqa | ||
differential_evolution_mcmc, | ||
dram_acmc, | ||
dream_mcmc, | ||
emcee_hammer_mcmc, | ||
haario_acmc, | ||
haario_bardenet_acmc, | ||
hamiltonian_mcmc, | ||
mala_mcmc, | ||
metropolis_random_walk_mcmc, | ||
monomial_gamma_hamiltonian_mcmc, | ||
no_u_turn_mcmc, | ||
population_mcmc, | ||
relativistic_mcmc, | ||
slice_stepout_mcmc, | ||
) | ||
|
||
|
||
from .haario_bardenet_acmc import test_haario_bardenet_acmc_on_annulus | ||
from .haario_bardenet_acmc import test_haario_bardenet_acmc_on_banana | ||
from .haario_bardenet_acmc import test_haario_bardenet_acmc_on_correlated_gaussian | ||
from .haario_bardenet_acmc import test_haario_bardenet_acmc_on_two_dim_gaussian | ||
# Test discovery methods | ||
from ._discovery import tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# | ||
# Functional test discovery methods for PINTS. | ||
# | ||
# This file is part of PINTS (https://github.com/pints-team/pints/) which is | ||
# released under the BSD 3-clause license. See accompanying LICENSE.md for | ||
# copyright notice and full license details. | ||
# | ||
import inspect | ||
|
||
import pints.functionaltests as ft | ||
|
||
|
||
def tests(method=None): | ||
""" | ||
Returns a list of all functional tests, each represented as a tuple | ||
``(method, test)`` where ``method`` is the PINTS class being tested and | ||
``test`` is a callable that returns the test results. | ||
If the optional argument ``method`` is given, only tests for this method | ||
are returned. | ||
""" | ||
# Get all modules imported into this module | ||
modules = [getattr(ft, x) for x in dir(ft) if not x.startswith('_')] | ||
modules = [x for x in modules if inspect.ismodule(x)] | ||
|
||
# Look for (explicitly defined) tests | ||
tests = [] | ||
for module in modules: | ||
try: | ||
m_method = module._method | ||
m_tests = module._functional_tests | ||
except AttributeError: | ||
continue | ||
|
||
if method is None or method == m_method: | ||
for test in m_tests: | ||
tests.append((m_method, test)) | ||
|
||
return tests | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.