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

Refactor validation tests #47

Merged
merged 12 commits into from
Aug 22, 2024
Merged

Refactor validation tests #47

merged 12 commits into from
Aug 22, 2024

Conversation

elray1
Copy link
Contributor

@elray1 elray1 commented Aug 20, 2024

In #41, we refactored some validations that were duplicated in transform_point_model_out and transform_quantile_model_out into a new/separate function, validate_model_out_target_obs that is called from each of those transform functions.

The main purpose of this PR is to tidy up the unit tests in an analogous way, so that tests of the transform functions that were really about those validation checks how just test the validation function instead. This reduces some duplication in tests.

Along the way I found a couple of errors in test setup which I have also fixed, and also added another check to validate_model_out_target_obs.

Copy link

github-actions bot commented Aug 20, 2024

@elray1 elray1 mentioned this pull request Aug 21, 2024
@zkamvar zkamvar self-requested a review August 22, 2024 13:30
Copy link
Member

@zkamvar zkamvar left a comment

Choose a reason for hiding this comment

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

This looks good. I made my notes below and a couple of broad observations:

  1. I would turn the warning into an error. Warnings are a weird sort of alert in R. Messages inform the user of processes that are going on and Errors tell the user that something is wrong. Warnings are a way of telling the user that something is weird and maybe wrong, but it shows up after the damage has been done.
  2. It's not a bad idea to test for the same error/warning in multiple places
  3. just a small note for testing errors: if it comes from another package, we may run into issues in the future if error messages change.

R/validate.R Outdated Show resolved Hide resolved
tests/testthat/test-transform_point_model_out.R Outdated Show resolved Hide resolved
tests/testthat/test-validate_model_out_target_obs.R Outdated Show resolved Hide resolved
tests/testthat/test-validate_model_out_target_obs.R Outdated Show resolved Hide resolved
tests/testthat/test-validate_model_out_target_obs.R Outdated Show resolved Hide resolved
tests/testthat/test-validate_model_out_target_obs.R Outdated Show resolved Hide resolved
tests/testthat/test-validate_model_out_target_obs.R Outdated Show resolved Hide resolved
elray1 and others added 8 commits August 22, 2024 12:13
Co-authored-by: Zhian N. Kamvar <zkamvar@gmail.com>
Co-authored-by: Zhian N. Kamvar <zkamvar@gmail.com>
Co-authored-by: Zhian N. Kamvar <zkamvar@gmail.com>
Co-authored-by: Zhian N. Kamvar <zkamvar@gmail.com>
Co-authored-by: Zhian N. Kamvar <zkamvar@gmail.com>
Co-authored-by: Zhian N. Kamvar <zkamvar@gmail.com>
Co-authored-by: Zhian N. Kamvar <zkamvar@gmail.com>
@zkamvar zkamvar self-requested a review August 22, 2024 16:54
Copy link
Member

@zkamvar zkamvar left a comment

Choose a reason for hiding this comment

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

Thank you for the changes. There is still linting, but I guarantee that's my fault (I litter whitespace at the end of lines)

@elray1
Copy link
Contributor Author

elray1 commented Aug 22, 2024

Thanks for the constructive review! I'll merge this now.

@elray1 elray1 merged commit 2a202ce into main Aug 22, 2024
8 checks passed
@elray1 elray1 deleted the refactor_validation_tests branch August 22, 2024 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants