Skip to content

Commit 91f9c5f

Browse files
committed
alterations to docstrings
1 parent 34404ae commit 91f9c5f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pymc/testing.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,10 @@ def mock_sample(draws: int = 10, **kwargs):
994994
--------
995995
Using mock_sample with pytest
996996
997+
.. note::
998+
999+
Use :func:`pymc.testing.mock_sample_setup_and_teardown` directly for pytest fixtures.
1000+
9971001
.. code-block:: python
9981002
9991003
import pytest
@@ -1043,6 +1047,7 @@ def mock_sample_setup_and_teardown():
10431047
PyMC's sampling functionality with faster alternatives for testing purposes.
10441048
10451049
Effects during the fixture's active period:
1050+
10461051
* Replaces pm.sample with mock_sample, which uses prior predictive sampling
10471052
instead of MCMC
10481053
* Replaces pm.Flat with pm.Normal to avoid issues with unbounded priors
@@ -1051,8 +1056,11 @@ def mock_sample_setup_and_teardown():
10511056
10521057
Examples
10531058
--------
1059+
Use with `pytest` to mock actual PyMC sampling in test suite.
1060+
10541061
.. code-block:: python
10551062
1063+
# tests/conftest.py
10561064
import pytest
10571065
import pymc as pm
10581066
from pymc.testing import mock_sample_setup_and_teardown
@@ -1061,6 +1069,7 @@ def mock_sample_setup_and_teardown():
10611069
mock_pymc_sample = pytest.fixture(scope="function")(mock_sample_setup_and_teardown)
10621070
10631071
1072+
# tests/test_model.py
10641073
# Use in a test function
10651074
def test_model_inference(mock_pymc_sample):
10661075
with pm.Model() as model:

0 commit comments

Comments
 (0)