Skip to content
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

Update the geometric icdf test for newer SciPy #218

Merged
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 conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ def pytest_sessionstart(session):
os.environ["AESARA_FLAGS"] = ",".join(
[
os.environ.setdefault("AESARA_FLAGS", ""),
"warn__ignore_bug_before=all,on_opt_error=raise,on_shape_error=raise",
"warn__ignore_bug_before=all,on_opt_error=raise,on_shape_error=raise,cast_policy=numpy+floatX",
]
)
10 changes: 5 additions & 5 deletions tests/test_logprob.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,11 +832,11 @@ def test_geometric_logcdf(dist_params, obs, size, error):
@pytest.mark.parametrize(
"dist_params, obs, size",
[
((0.1,), np.array([-0.5, 0, 0.1, 0.5, 0.9, 1.0, 1.5], dtype=np.int64), ()),
((0.5,), np.array([-0.5, 0, 0.1, 0.5, 0.9, 1.0, 1.5], dtype=np.int64), (3, 2)),
((0.1,), np.array([0, 0.1, 0.5, 0.9], dtype=np.float64), ()),
((0.5,), np.array([0, 0.1, 0.5, 0.9], dtype=np.float64), (3, 2)),
(
(np.array([0.0, 0.2, 0.5, 1.0]),),
np.array([0.7, 0.7, 0.7, 0.7], dtype=np.int64),
(np.array([0.001, 0.02, 0.5, 0.9]),),
np.array([0.7, 0.7, 0.7, 0.7], dtype=np.float64),
(),
),
],
Expand All @@ -850,7 +850,7 @@ def test_geometric_icdf(dist_params, obs, size):

def scipy_geom_icdf(value, p):
# Scipy ppf returns floats
return stats.geom.ppf(value, p).astype(value.dtype)
return stats.geom.ppf(value, p).astype(np.int64)

scipy_logprob_tester(x, obs, dist_params, test_fn=scipy_geom_icdf, test="icdf")

Expand Down