[Repo Assist] test: add tests for RandomCommonCause refuter#1413
Open
github-actions[bot] wants to merge 2 commits intomainfrom
Open
[Repo Assist] test: add tests for RandomCommonCause refuter#1413github-actions[bot] wants to merge 2 commits intomainfrom
github-actions[bot] wants to merge 2 commits intomainfrom
Conversation
The `random_common_cause` refuter had no dedicated test file. This commit adds `tests/causal_refuters/test_random_common_cause_refuter.py` with 6 tests covering: - Continuous treatment (linear regression) - Binary treatment (linear regression) - Categorical treatment (linear regression) - Refutation type string validation - Functional API (`refute_random_common_cause` directly) - Reproducibility with fixed `random_state` Also adds the corresponding handler in `tests/causal_refuters/base.py` so `SimpleRefuter` can drive the refuter via `null_refutation_test()`. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
21 tasks
Member
|
failing linter Run poetry run poe format_check Oh no! 💥 💔 💥 |
25 tasks
…-2b4c3976fb68d46d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This is an automated pull request from Repo Assist.
Summary
The
RandomCommonCauserefuter (method_name="random_common_cause") had zero test coverage — no test file existed for it, andtests/causal_refuters/base.pyhad no handler for it either. This PR fills that gap.Changes
tests/causal_refuters/test_random_common_cause_refuter.py(new file)Six tests covering:
test_refutation_random_common_cause_continuousSimpleRefuter— estimate stays within 10% tolerance after introducing random confoundertest_refutation_random_common_cause_binarySimpleRefutertest_refutation_random_common_cause_categorySimpleRefutertest_refutation_random_common_cause_refutation_typeref.refutation_typecontains the expected stringtest_refute_random_common_cause_functional_apirefute_random_common_cause()directly, verifies non-None finite resulttest_refute_random_common_cause_reproducible_with_random_staterandom_state=0seed produces identicalnew_effecton two runstests/causal_refuters/base.pyAdds a
random_common_causebranch inSimpleRefuter.null_refutation_test()soSimpleRefutercan drive this refuter — matching the existing pattern forbootstrap_refuter,data_subset_refuter, etc.Test Status
✅ All 6 new tests pass locally:
No existing tests were changed or broken.