Skip to content

add extra tests#46

Merged
malcolmbarrett merged 2 commits intomainfrom
numerics
Aug 4, 2025
Merged

add extra tests#46
malcolmbarrett merged 2 commits intomainfrom
numerics

Conversation

@malcolmbarrett
Copy link
Member

To support the changes in #45

@malcolmbarrett malcolmbarrett requested a review from Copilot August 4, 2025 15:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@malcolmbarrett malcolmbarrett merged commit 3de7f1e into main Aug 4, 2025
8 checks passed
@malcolmbarrett malcolmbarrett deleted the numerics branch August 4, 2025 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant