Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds comprehensive test coverage for numeric vs. psw weight equivalence and backward compatibility to support changes in #45. The tests ensure that balance computation functions work identically with both numeric weights and psw (propensity score weights) objects, maintaining backward compatibility while introducing new functionality.
Key changes:
- Added extensive test suite for numeric/psw weight equivalence across all balance functions
- Created tests for the
extract_weight_data()utility function - Included edge cases, performance comparisons, and mixed weight type scenarios
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/testthat/test-numeric-psw-equivalence.R | Comprehensive test suite covering backward compatibility, equivalence testing, edge cases, and performance comparisons between numeric and psw weights |
| tests/testthat/test-extract_weight_data.R | Test coverage for utility function that extracts numeric data from weight objects, handling various input types and edge cases |
Comments suppressed due to low confidence (2)
tests/testthat/test-numeric-psw-equivalence.R:45
- [nitpick] This test verifies identical results but doesn't test what happens when results should differ. Consider adding a test case where different estimand types might produce different behaviors or edge cases where equivalence might break down.
test_that("numeric and psw weights produce identical results", {
tests/testthat/test-numeric-psw-equivalence.R:300
- Performance timing tests can be flaky and unreliable, especially on CI systems with variable load. Consider using a larger tolerance or focusing on functional correctness rather than performance timing.
expect_true(time_psw[["elapsed"]] < time_numeric[["elapsed"]] * 1.5)
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.
To support the changes in #45