Skip to content

Commit

Permalink
Restructure the test suite to follow the code (#6111)
Browse files Browse the repository at this point in the history
* Split up test_gp.py

* Split up test_ode.py

* Split up test_tuning.py

* Move test_starting.py into tuning/

* Replace test_ndarray_backend.py

* Rename test_data_container.py into test_data.py

* Move test_idata_conversion.py into backends

* Merge test_minibatches.py into test_data.py

* Merge test_modelcontext.py into test_model.py

* Merge test_pickling.py into test_model.py

* Move test_quadpotential.py to step_methods/hmc/

* Move test_posdef_sym into test_multivariate

* Move test_profile into test_model

* Move test_updates.py into variational/

* Parametrize the posdef_symmetric test
  • Loading branch information
Armavica authored Sep 13, 2022
1 parent efa6785 commit bbb3082
Show file tree
Hide file tree
Showing 29 changed files with 1,246 additions and 1,291 deletions.
33 changes: 16 additions & 17 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,10 @@ jobs:
pymc/tests/distributions/test_logprob.py
pymc/tests/test_aesaraf.py
pymc/tests/test_math.py
pymc/tests/test_posdef_sym.py
pymc/tests/test_ndarray_backend.py
pymc/tests/backends/test_ndarray.py
pymc/tests/test_hmc.py
pymc/tests/test_func_utils.py
pymc/tests/distributions/test_shape_utils.py
pymc/tests/test_starting.py
pymc/tests/distributions/test_mixture.py
- |
Expand All @@ -59,27 +57,28 @@ jobs:
pymc/tests/distributions/test_simulator.py
- |
pymc/tests/test_tuning.py
pymc/tests/tuning/test_scaling.py
pymc/tests/tuning/test_starting.py
pymc/tests/test_shared.py
pymc/tests/test_types.py
- |
pymc/tests/test_modelcontext.py
pymc/tests/distributions/test_dist_math.py
pymc/tests/test_minibatches.py
pymc/tests/test_pickling.py
pymc/tests/distributions/test_transform.py
pymc/tests/test_parallel_sampling.py
pymc/tests/test_printing.py
- |
pymc/tests/distributions/test_timeseries.py
pymc/tests/test_gp.py
pymc/tests/gp/test_cov.py
pymc/tests/gp/test_gp.py
pymc/tests/gp/test_mean.py
pymc/tests/gp/test_util.py
pymc/tests/test_model.py
pymc/tests/test_model_graph.py
pymc/tests/test_ode.py
pymc/tests/test_profile.py
pymc/tests/test_quadpotential.py
pymc/tests/ode/test_ode.py
pymc/tests/ode/test_utils.py
pymc/tests/step_methods/hmc/test_quadpotential.py
fail-fast: false
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -147,8 +146,8 @@ jobs:
python-version: ["3.8"]
test-subset:
- pymc/tests/test_variational_inference.py pymc/tests/test_initial_point.py
- pymc/tests/test_pickling.py pymc/tests/test_profile.py pymc/tests/test_step.py
- pymc/tests/test_gp.py pymc/tests/test_ode.py pymc/tests/test_smc.py pymc/tests/test_parallel_sampling.py
- pymc/tests/test_model.py pymc/tests/test_step.py
- pymc/tests/gp/test_cov.py pymc/tests/gp/test_gp.py pymc/tests/gp/test_mean.py pymc/tests/gp/test_util.py pymc/tests/ode/test_ode.py pymc/tests/ode/test_utils.py pymc/tests/test_smc.py pymc/tests/test_parallel_sampling.py
- pymc/tests/test_sampling.py pymc/tests/test_posteriors.py

fail-fast: false
Expand Down Expand Up @@ -220,15 +219,15 @@ jobs:
test-subset:
- |
pymc/tests/test_parallel_sampling.py
pymc/tests/test_data_container.py
pymc/tests/test_data.py
pymc/tests/test_missing.py
- |
pymc/tests/test_sampling.py
- |
pymc/tests/test_idata_conversion.py
pymc/tests/test_updates.py
pymc/tests/backends/test_arviz.py
pymc/tests/variational/test_updates.py
fail-fast: false
runs-on: ${{ matrix.os }}
env:
Expand Down Expand Up @@ -361,7 +360,7 @@ jobs:
floatx: [float32]
python-version: ["3.10"]
test-subset:
- pymc/tests/test_sampling.py pymc/tests/test_ode.py
- pymc/tests/test_sampling.py pymc/tests/ode/test_ode.py pymc/tests/ode/test_utils.py
fail-fast: false
runs-on: ${{ matrix.os }}
env:
Expand Down
Empty file added pymc/tests/backends/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import pytest

from pymc.backends import base, ndarray
from pymc.tests import backend_fixtures as bf
from pymc.tests.backends import fixtures as bf

STATS1 = [{"a": np.float64, "b": bool}]

Expand Down
19 changes: 19 additions & 0 deletions pymc/tests/distributions/test_multivariate.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from pymc.distributions.multivariate import (
_LKJCholeskyCov,
_OrderedMultinomial,
posdef,
quaddist_matrix,
)
from pymc.distributions.shape_utils import change_dist_size, to_tuple
Expand Down Expand Up @@ -1874,3 +1875,21 @@ def test_car_rng_fn(sparse):
)
f -= 1
assert p > delta


@pytest.mark.parametrize(
"matrix, result",
[
([[1.0, 0], [0, 1]], 1),
([[1.0, 2], [2, 1]], 0),
([[1.0, 1], [1, 1]], 0),
([[1, 0.99, 1], [0.99, 1, 0.999], [1, 0.999, 1]], 0),
],
)
def test_posdef_symmetric(matrix, result):
"""The test returns 0 if the matrix has 0 eigenvalue.
Is this correct?
"""
data = np.array(matrix, dtype=aesara.config.floatX)
assert posdef(data) == result
Empty file added pymc/tests/gp/__init__.py
Empty file.
Loading

0 comments on commit bbb3082

Please sign in to comment.