From 654171215d476ed932b31a25444661836727e3c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicholas=20Kr=C3=A4mer?= Date: Fri, 25 Oct 2024 11:54:00 +0200 Subject: [PATCH] Flatten the directory structure in the tests to mirror the module structure in the source (#789) * Flatten the directory structure in the tests to mimic the src layout * Mirror the src filenames in the test filenames --- .../test_overwrite_control_flow.py | 0 .../__init__.py | 0 .../test_calibration_dynamic_vs_mle.py} | 0 .../test_calibration_mle_vs_none.py} | 0 .../test_corrections.py} | 0 .../test_cubature_equivalence.py} | 0 .../test_strategy_smoother_vs_filter.py} | 0 .../test_strategy_smoother_vs_fixedpoint.py} | 0 ..._strategy_warnings_for_wrong_strategies.py} | 0 tests/test_solvers/test_calibrated/__init__.py | 12 ------------ tests/test_solvers/test_misc/__init__.py | 1 - tests/test_solvers/test_strategies/__init__.py | 18 ------------------ .../test_corrections/__init__.py | 9 --------- .../test_strategies/test_cubature/__init__.py | 1 - .../{test_solvers => }/test_stats/__init__.py | 0 .../test_stats/test_log_marginal_likelihood.py | 0 ..._log_marginal_likelihood_terminal_values.py | 0 .../test_stats/test_offgrid_marginals.py | 0 .../test_stats/test_sample.py | 0 19 files changed, 41 deletions(-) rename tests/test_backend/{test_control_flow => }/test_overwrite_control_flow.py (100%) rename tests/{test_solvers => test_ivpsolvers}/__init__.py (100%) rename tests/{test_solvers/test_calibrated/test_dynamic_calibration_on_exponential.py => test_ivpsolvers/test_calibration_dynamic_vs_mle.py} (100%) rename tests/{test_solvers/test_calibrated/test_mle_calibration_vs_calibrationfree.py => test_ivpsolvers/test_calibration_mle_vs_none.py} (100%) rename tests/{test_solvers/test_strategies/test_corrections/test_rmse_of_correction.py => test_ivpsolvers/test_corrections.py} (100%) rename tests/{test_solvers/test_strategies/test_cubature/test_equivalence.py => test_ivpsolvers/test_cubature_equivalence.py} (100%) rename tests/{test_solvers/test_strategies/test_filter_vs_smoother_rmse.py => test_ivpsolvers/test_strategy_smoother_vs_filter.py} (100%) rename tests/{test_solvers/test_strategies/test_smoother_vs_fixedpoint_equivalence.py => test_ivpsolvers/test_strategy_smoother_vs_fixedpoint.py} (100%) rename tests/{test_solvers/test_misc/test_warnings_for_wrong_strategies.py => test_ivpsolvers/test_strategy_warnings_for_wrong_strategies.py} (100%) delete mode 100644 tests/test_solvers/test_calibrated/__init__.py delete mode 100644 tests/test_solvers/test_misc/__init__.py delete mode 100644 tests/test_solvers/test_strategies/__init__.py delete mode 100644 tests/test_solvers/test_strategies/test_corrections/__init__.py delete mode 100644 tests/test_solvers/test_strategies/test_cubature/__init__.py rename tests/{test_solvers => }/test_stats/__init__.py (100%) rename tests/{test_solvers => }/test_stats/test_log_marginal_likelihood.py (100%) rename tests/{test_solvers => }/test_stats/test_log_marginal_likelihood_terminal_values.py (100%) rename tests/{test_solvers => }/test_stats/test_offgrid_marginals.py (100%) rename tests/{test_solvers => }/test_stats/test_sample.py (100%) diff --git a/tests/test_backend/test_control_flow/test_overwrite_control_flow.py b/tests/test_backend/test_overwrite_control_flow.py similarity index 100% rename from tests/test_backend/test_control_flow/test_overwrite_control_flow.py rename to tests/test_backend/test_overwrite_control_flow.py diff --git a/tests/test_solvers/__init__.py b/tests/test_ivpsolvers/__init__.py similarity index 100% rename from tests/test_solvers/__init__.py rename to tests/test_ivpsolvers/__init__.py diff --git a/tests/test_solvers/test_calibrated/test_dynamic_calibration_on_exponential.py b/tests/test_ivpsolvers/test_calibration_dynamic_vs_mle.py similarity index 100% rename from tests/test_solvers/test_calibrated/test_dynamic_calibration_on_exponential.py rename to tests/test_ivpsolvers/test_calibration_dynamic_vs_mle.py diff --git a/tests/test_solvers/test_calibrated/test_mle_calibration_vs_calibrationfree.py b/tests/test_ivpsolvers/test_calibration_mle_vs_none.py similarity index 100% rename from tests/test_solvers/test_calibrated/test_mle_calibration_vs_calibrationfree.py rename to tests/test_ivpsolvers/test_calibration_mle_vs_none.py diff --git a/tests/test_solvers/test_strategies/test_corrections/test_rmse_of_correction.py b/tests/test_ivpsolvers/test_corrections.py similarity index 100% rename from tests/test_solvers/test_strategies/test_corrections/test_rmse_of_correction.py rename to tests/test_ivpsolvers/test_corrections.py diff --git a/tests/test_solvers/test_strategies/test_cubature/test_equivalence.py b/tests/test_ivpsolvers/test_cubature_equivalence.py similarity index 100% rename from tests/test_solvers/test_strategies/test_cubature/test_equivalence.py rename to tests/test_ivpsolvers/test_cubature_equivalence.py diff --git a/tests/test_solvers/test_strategies/test_filter_vs_smoother_rmse.py b/tests/test_ivpsolvers/test_strategy_smoother_vs_filter.py similarity index 100% rename from tests/test_solvers/test_strategies/test_filter_vs_smoother_rmse.py rename to tests/test_ivpsolvers/test_strategy_smoother_vs_filter.py diff --git a/tests/test_solvers/test_strategies/test_smoother_vs_fixedpoint_equivalence.py b/tests/test_ivpsolvers/test_strategy_smoother_vs_fixedpoint.py similarity index 100% rename from tests/test_solvers/test_strategies/test_smoother_vs_fixedpoint_equivalence.py rename to tests/test_ivpsolvers/test_strategy_smoother_vs_fixedpoint.py diff --git a/tests/test_solvers/test_misc/test_warnings_for_wrong_strategies.py b/tests/test_ivpsolvers/test_strategy_warnings_for_wrong_strategies.py similarity index 100% rename from tests/test_solvers/test_misc/test_warnings_for_wrong_strategies.py rename to tests/test_ivpsolvers/test_strategy_warnings_for_wrong_strategies.py diff --git a/tests/test_solvers/test_calibrated/__init__.py b/tests/test_solvers/test_calibrated/__init__.py deleted file mode 100644 index cf3d3537c..000000000 --- a/tests/test_solvers/test_calibrated/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -"""Tests for calibration/solver styles. - -To ensure that all calibration-/solver-styles work correctly, we do the following: - -* Only the dynamic calibration can solve an exponentially increasing problem -(see the notebook). Solve such a problem and compare to the closed-form solution. -We run this test for all state-space model factorisations -(except scalar, which is covered through blockdiagonal) - -The MLE solver is heavily tested through all the other tests (it is the default). -The calibration-free solver is tested in the dense-output/parameter-estimation context. -""" diff --git a/tests/test_solvers/test_misc/__init__.py b/tests/test_solvers/test_misc/__init__.py deleted file mode 100644 index 9dcf5afd8..000000000 --- a/tests/test_solvers/test_misc/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Tests for selected implementations. Usually to verify once-resolved bugfixes.""" diff --git a/tests/test_solvers/test_strategies/__init__.py b/tests/test_solvers/test_strategies/__init__.py deleted file mode 100644 index cdfd34ea8..000000000 --- a/tests/test_solvers/test_strategies/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -"""Tests for the strategy choices. - -To ensure that all strategies work correctly, we do the following: - -* the RMSE of the smoother should be (slightly) lower than the RMSE of the filter -using the same configuration (e.g. fixed grid solutions). -Both should yield a reasonable approximation of the ODE solution. -(This is a slightly unpredictable test because it depends highly on parameter choices.) -* The result of the fixed-point smoother in solve_adaptive_save_at should be *identical* -to interpolating the smoother results (we can reuse the solution from earlier). -This is a strict test, and one that has failed many times in the past. - -If these are true (and, again, assuming that interpolation works correctly), -the strategies must work correctly. - -Since the strategies are closely tied to the extrapolation models, -we need to run these tests with one solver-recipe for each state-space factorisation. -""" diff --git a/tests/test_solvers/test_strategies/test_corrections/__init__.py b/tests/test_solvers/test_strategies/test_corrections/__init__.py deleted file mode 100644 index ae33900eb..000000000 --- a/tests/test_solvers/test_strategies/test_corrections/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -"""Tests for state-space factorisations (at least, for the ones not tested otherwise). - -To ensure that all state-space model factorisations work as expected, -we need to consider extrapolation and correction separately. -We already know that extrapolation is correct (from the strategy tests). - -To check that linearisation/correction are correct, -we run a simple simpluation for each recipe and compare RMSEs. -""" diff --git a/tests/test_solvers/test_strategies/test_cubature/__init__.py b/tests/test_solvers/test_strategies/test_cubature/__init__.py deleted file mode 100644 index b4bac83a4..000000000 --- a/tests/test_solvers/test_strategies/test_cubature/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Tests for cubature methods.""" diff --git a/tests/test_solvers/test_stats/__init__.py b/tests/test_stats/__init__.py similarity index 100% rename from tests/test_solvers/test_stats/__init__.py rename to tests/test_stats/__init__.py diff --git a/tests/test_solvers/test_stats/test_log_marginal_likelihood.py b/tests/test_stats/test_log_marginal_likelihood.py similarity index 100% rename from tests/test_solvers/test_stats/test_log_marginal_likelihood.py rename to tests/test_stats/test_log_marginal_likelihood.py diff --git a/tests/test_solvers/test_stats/test_log_marginal_likelihood_terminal_values.py b/tests/test_stats/test_log_marginal_likelihood_terminal_values.py similarity index 100% rename from tests/test_solvers/test_stats/test_log_marginal_likelihood_terminal_values.py rename to tests/test_stats/test_log_marginal_likelihood_terminal_values.py diff --git a/tests/test_solvers/test_stats/test_offgrid_marginals.py b/tests/test_stats/test_offgrid_marginals.py similarity index 100% rename from tests/test_solvers/test_stats/test_offgrid_marginals.py rename to tests/test_stats/test_offgrid_marginals.py diff --git a/tests/test_solvers/test_stats/test_sample.py b/tests/test_stats/test_sample.py similarity index 100% rename from tests/test_solvers/test_stats/test_sample.py rename to tests/test_stats/test_sample.py