Skip to content

Commit bbb3082

Browse files
authored
Restructure the test suite to follow the code (#6111)
* 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
1 parent efa6785 commit bbb3082

29 files changed

+1246
-1291
lines changed

.github/workflows/tests.yml

+16-17
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,10 @@ jobs:
4141
pymc/tests/distributions/test_logprob.py
4242
pymc/tests/test_aesaraf.py
4343
pymc/tests/test_math.py
44-
pymc/tests/test_posdef_sym.py
45-
pymc/tests/test_ndarray_backend.py
44+
pymc/tests/backends/test_ndarray.py
4645
pymc/tests/test_hmc.py
4746
pymc/tests/test_func_utils.py
4847
pymc/tests/distributions/test_shape_utils.py
49-
pymc/tests/test_starting.py
5048
pymc/tests/distributions/test_mixture.py
5149
5250
- |
@@ -59,27 +57,28 @@ jobs:
5957
pymc/tests/distributions/test_simulator.py
6058
6159
- |
62-
pymc/tests/test_tuning.py
60+
pymc/tests/tuning/test_scaling.py
61+
pymc/tests/tuning/test_starting.py
6362
pymc/tests/test_shared.py
6463
pymc/tests/test_types.py
6564
6665
- |
67-
pymc/tests/test_modelcontext.py
6866
pymc/tests/distributions/test_dist_math.py
69-
pymc/tests/test_minibatches.py
70-
pymc/tests/test_pickling.py
7167
pymc/tests/distributions/test_transform.py
7268
pymc/tests/test_parallel_sampling.py
7369
pymc/tests/test_printing.py
7470
7571
- |
7672
pymc/tests/distributions/test_timeseries.py
77-
pymc/tests/test_gp.py
73+
pymc/tests/gp/test_cov.py
74+
pymc/tests/gp/test_gp.py
75+
pymc/tests/gp/test_mean.py
76+
pymc/tests/gp/test_util.py
7877
pymc/tests/test_model.py
7978
pymc/tests/test_model_graph.py
80-
pymc/tests/test_ode.py
81-
pymc/tests/test_profile.py
82-
pymc/tests/test_quadpotential.py
79+
pymc/tests/ode/test_ode.py
80+
pymc/tests/ode/test_utils.py
81+
pymc/tests/step_methods/hmc/test_quadpotential.py
8382
8483
fail-fast: false
8584
runs-on: ${{ matrix.os }}
@@ -147,8 +146,8 @@ jobs:
147146
python-version: ["3.8"]
148147
test-subset:
149148
- pymc/tests/test_variational_inference.py pymc/tests/test_initial_point.py
150-
- pymc/tests/test_pickling.py pymc/tests/test_profile.py pymc/tests/test_step.py
151-
- pymc/tests/test_gp.py pymc/tests/test_ode.py pymc/tests/test_smc.py pymc/tests/test_parallel_sampling.py
149+
- pymc/tests/test_model.py pymc/tests/test_step.py
150+
- 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
152151
- pymc/tests/test_sampling.py pymc/tests/test_posteriors.py
153152

154153
fail-fast: false
@@ -220,15 +219,15 @@ jobs:
220219
test-subset:
221220
- |
222221
pymc/tests/test_parallel_sampling.py
223-
pymc/tests/test_data_container.py
222+
pymc/tests/test_data.py
224223
pymc/tests/test_missing.py
225224
226225
- |
227226
pymc/tests/test_sampling.py
228227
229228
- |
230-
pymc/tests/test_idata_conversion.py
231-
pymc/tests/test_updates.py
229+
pymc/tests/backends/test_arviz.py
230+
pymc/tests/variational/test_updates.py
232231
fail-fast: false
233232
runs-on: ${{ matrix.os }}
234233
env:
@@ -361,7 +360,7 @@ jobs:
361360
floatx: [float32]
362361
python-version: ["3.10"]
363362
test-subset:
364-
- pymc/tests/test_sampling.py pymc/tests/test_ode.py
363+
- pymc/tests/test_sampling.py pymc/tests/ode/test_ode.py pymc/tests/ode/test_utils.py
365364
fail-fast: false
366365
runs-on: ${{ matrix.os }}
367366
env:

pymc/tests/backends/__init__.py

Whitespace-only changes.
File renamed without changes.

pymc/tests/test_ndarray_backend.py renamed to pymc/tests/backends/test_ndarray.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import pytest
1818

1919
from pymc.backends import base, ndarray
20-
from pymc.tests import backend_fixtures as bf
20+
from pymc.tests.backends import fixtures as bf
2121

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

pymc/tests/distributions/test_multivariate.py

+19
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from pymc.distributions.multivariate import (
3737
_LKJCholeskyCov,
3838
_OrderedMultinomial,
39+
posdef,
3940
quaddist_matrix,
4041
)
4142
from pymc.distributions.shape_utils import change_dist_size, to_tuple
@@ -1874,3 +1875,21 @@ def test_car_rng_fn(sparse):
18741875
)
18751876
f -= 1
18761877
assert p > delta
1878+
1879+
1880+
@pytest.mark.parametrize(
1881+
"matrix, result",
1882+
[
1883+
([[1.0, 0], [0, 1]], 1),
1884+
([[1.0, 2], [2, 1]], 0),
1885+
([[1.0, 1], [1, 1]], 0),
1886+
([[1, 0.99, 1], [0.99, 1, 0.999], [1, 0.999, 1]], 0),
1887+
],
1888+
)
1889+
def test_posdef_symmetric(matrix, result):
1890+
"""The test returns 0 if the matrix has 0 eigenvalue.
1891+
1892+
Is this correct?
1893+
"""
1894+
data = np.array(matrix, dtype=aesara.config.floatX)
1895+
assert posdef(data) == result

pymc/tests/gp/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)