Skip to content

Make tests compatible with latest release of PyTensor #6782

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pymc/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,7 @@ def set_data(
if isinstance(length_tensor_origin, TensorConstant):
raise ShapeError(
f"Resizing dimension '{dname}' with values of length {new_length} would lead to incompatibilities, "
f"because the dimension length is tied to a {length_tensor_origin}. "
f"because the dimension length is tied to a TensorConstant. "
f"Check if the dimension was defined implicitly before the shared variable '{name}' was created, "
f"for example by another model variable.",
actual=new_length,
Expand Down
7 changes: 6 additions & 1 deletion tests/distributions/test_multivariate.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,12 @@ def test_mvnormal_indef(self):
f_logp(cov_val, np.ones(2))
dlogp = pt.grad(mvn_logp, cov)
f_dlogp = pytensor.function([cov, x], dlogp)
assert not np.all(np.isfinite(f_dlogp(cov_val, np.ones(2))))
try:
res = f_dlogp(cov_val, np.ones(2))
except ValueError:
pass # Op raises internally
else:
assert not np.all(np.isfinite(res)) # Otherwise, should return nan

def test_mvnormal_init_fail(self):
with pm.Model():
Expand Down
2 changes: 1 addition & 1 deletion tests/logprob/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ def test_probability_inference(func, scipy_func, test_value):
def test_probability_inference_fails(func, func_name):
with pytest.raises(
NotImplementedError,
match=f"{func_name} method not implemented for Elemwise{{cos,no_inplace}}",
match=f"{func_name} method not implemented for (Elemwise{{cos,no_inplace}}|Cos)",
):
func(pt.cos(pm.Normal.dist()), 1)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_pytensorf.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ def step_wo_update(x, rng):

with pytest.raises(
ValueError,
match=r"No update found for at least one RNG used in Scan Op for\{cpu,test_scan\}",
match="No update found for at least one RNG used in Scan Op",
):
collect_default_updates([xs])

Expand Down