Skip to content

Commit e1ba7f8

Browse files
committed
Move test_sample_deterministic to TestSample class and rename it to test_deterministic_of_unobserved
1 parent 25c6772 commit e1ba7f8

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

pymc/tests/test_sampling.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,19 @@ def test_exceptions(self):
313313
with pytest.raises(NotImplementedError):
314314
xvars = [t["mu"] for t in trace]
315315

316+
def test_deterministic_of_unobserved(self):
317+
with pm.Model() as model:
318+
x = pm.HalfNormal("x", 1)
319+
y = pm.Deterministic("y", x + 100)
320+
idata = pm.sample(
321+
chains=1,
322+
tune=10,
323+
draws=50,
324+
compute_convergence_checks=False,
325+
)
326+
327+
np.testing.assert_allclose(idata.posterior["y"], idata.posterior["x"] + 100)
328+
316329

317330
def test_sample_find_MAP_does_not_modify_start():
318331
# see https://github.com/pymc-devs/pymc/pull/4458
@@ -1220,15 +1233,6 @@ def test_sample_from_xarray_posterior(self, point_list_arg_bug_fixture):
12201233
pp = pm.sample_posterior_predictive(idat.posterior, var_names=["d"])
12211234

12221235

1223-
def test_sample_deterministic():
1224-
with pm.Model() as model:
1225-
x = pm.HalfNormal("x", 1)
1226-
y = pm.Deterministic("y", x + 100)
1227-
idata = pm.sample(chains=1, draws=50, compute_convergence_checks=False)
1228-
1229-
np.testing.assert_allclose(idata.posterior["y"], idata.posterior["x"] + 100)
1230-
1231-
12321236
class TestDraw(SeededTest):
12331237
def test_univariate(self):
12341238
with pm.Model():

0 commit comments

Comments
 (0)