Skip to content

Commit 7312437

Browse files
committed
bit more explicit on the test
1 parent d3d965a commit 7312437

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

tests/test_testing.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,19 @@ def test_mock_sample(args, kwargs, expected_draws) -> None:
6363
mock_pymc_sample = pytest.fixture(scope="function")(mock_sample_setup_and_teardown)
6464

6565

66-
def test_fixture(mock_pymc_sample) -> None:
67-
# This has Flat distribution
68-
_, model, _ = simple_normal(bounded_prior=False)
66+
@pytest.fixture(scope="function")
67+
def dummy_model() -> pm.Model:
68+
with pm.Model() as model:
69+
pm.Flat("flat")
70+
pm.HalfFlat("half_flat")
6971

70-
with model:
72+
return model
73+
74+
75+
def test_fixture(mock_pymc_sample, dummy_model) -> None:
76+
with dummy_model:
7177
idata = pm.sample()
7278

73-
assert idata.posterior.sizes == {"chain": 1, "draw": 10}
79+
posterior = idata.posterior
80+
assert posterior.sizes == {"chain": 1, "draw": 10}
81+
assert (posterior["half_flat"] >= 0).all()

0 commit comments

Comments
 (0)