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

Implemented test in respond to #15 #36

Merged
merged 3 commits into from
Jul 10, 2023
Merged
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
15 changes: 14 additions & 1 deletion tests/estimation/test_get_estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ def x(data):
return data[0]


# t is raveled because some estimators fail with (n,1) inputs
@pytest.fixture
def t(data):
return data[1].ravel()
Expand All @@ -191,7 +192,7 @@ def m(data):

@pytest.fixture
def y(data):
return data[3].ravel()
return data[3].ravel() # same reason as t


@pytest.fixture
Expand Down Expand Up @@ -249,3 +250,15 @@ def test_total_is_direct_plus_indirect(effects_chap):
assert effects_chap[0] == pytest.approx(effects_chap[1] + effects_chap[4])
if not np.isnan(effects_chap[2]):
assert effects_chap[0] == pytest.approx(effects_chap[2] + effects_chap[3])


@pytest.mark.xfail
def test_robustness_to_ravel_format(data, estimator, config, effects_chap):
if "forest" in estimator:
judithabk6 marked this conversation as resolved.
Show resolved Hide resolved
pytest.skip("Forest estimator skipped")
assert np.all(
get_estimation(data[0], data[1], data[2], data[3], estimator, config)[0:5]
== pytest.approx(
effects_chap, nan_ok=True
) # effects_chap is obtained with data[1].ravel() and data[3].ravel()
)