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

0063 Move examples for internal functions to unit tests #69

Merged
merged 7 commits into from
Jul 24, 2024

Conversation

ShiyuC
Copy link
Collaborator

@ShiyuC ShiyuC commented Jul 19, 2024

This PR moves all the example sections for internal functions to unit tests.
Closes #63

Please check off each taskbox as an acknowledgment that you completed the task
or check off that it is not relevant to your Pull Request. This checklist is
part of the Github Action workflows and the Pull Request will not be merged into
the devel branch until you have checked off each task.

  • Place Closes #<insert_issue_number> into the beginning of your Pull z
    Request Title (Use Edit button in top-right if you need to update)
  • Code is formatted according to the
    tidyverse style guide. Run
    styler::style_file() to style R and Rmd files
  • Updated relevant unit tests or have written new unit tests, which should
    consider realistic data scenarios and edge cases, e.g. empty datasets, errors,
    boundary cases etc. - See
    Unit Test Guide
  • If you removed/replaced any function and/or function parameters, did you
    fully follow the
    deprecation guidance?
  • Update to all relevant roxygen headers and examples, including keywords
    and families. Refer to the
    categorization of functions to tag appropriate keyword/family.
  • Run devtools::document() so all .Rd files in the man folder and the
    NAMESPACE file in the project root are updated appropriately
  • Address any updates needed for vignettes and/or templates
  • Update NEWS.md if the changes pertain to a user-facing function (i.e. it
    has an @export tag) or documentation aimed at users (rather than developers)
  • Build oak site pkgdown::build_site() and check that all affected
    examples are displayed correctly and that all new functions occur on the "Reference" page.
  • Address or fix all lintr warnings and errors - lintr::lint_package()
  • Run R CMD check locally and address all errors and warnings - devtools::check()
  • Link the issue in the Development Section on the right hand side.
  • Address all merge conflicts and resolve appropriately
  • Pat yourself on the back for a job well done! Much love to your accomplishment!

@ShiyuC ShiyuC changed the title Move examples for internal functions to unit tests 0063 Move examples for internal functions to unit tests Jul 19, 2024
@ShiyuC ShiyuC self-assigned this Jul 19, 2024
Copy link

github-actions bot commented Jul 19, 2024

Code Coverage

Package Line Rate Health
sdtm.oak 93%
Summary 93% (949 / 1022)

@ShiyuC
Copy link
Collaborator Author

ShiyuC commented Jul 19, 2024

@ramiromagno @edgar-manukyan May I request your review of this MR? Thanks in advance

Copy link
Collaborator

@edgar-manukyan edgar-manukyan left a comment

Choose a reason for hiding this comment

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

Thanks so much @ShiyuC for massive cleanup and awesome test 👍 I left one question for your kind consideration.

NAMESPACE Show resolved Hide resolved
R/derive_blfl.R Show resolved Hide resolved
Copy link
Collaborator

@ramiromagno ramiromagno left a comment

Choose a reason for hiding this comment

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

@ShiyuC: great job! Thank you so much.

I think the only remaining bit is really to fix the test failures from the testing of derive_blfl(). But I am guessing Kamil or Ram are better equipped to give you feedback here as they worked on this function.

And also still on derive_blfl(), I would convert expect_snapshot_error() to expect_snapshot(..., error = TRUE) as expect_snapshot_error() is under "questioning" status (check its documentation).

Test failures related to derive_blfl()

==> Testing R file using 'testthat'Loading sdtm.oak
[ FAIL 8 | WARN 0 | SKIP 0 | PASS 7 ]

── Failure (test-derive_blfl.R:47:3): derive_blfl sdmt_in validations work ─────
Snapshot of `derive_blfl(...)` has changed:
old vs new
- Required variable `DOMAIN` is missing
+ Required variable `DOMAIN` is missing in `sdtm_in`

* Run testthat::snapshot_accept('derive_blfl') to accept the change.
* Run testthat::snapshot_review('derive_blfl') to interactively review the change.

── Failure (test-derive_blfl.R:58:3): derive_blfl sdmt_in validations work ─────
Snapshot of `derive_blfl(...)` has changed:
old vs new
- Required variables `oak_id`, `raw_source` and `patient_number` are missing
+ Required variables `oak_id`, `raw_source`, and `patient_number` are missing in `sdtm_in`

* Run testthat::snapshot_accept('derive_blfl') to accept the change.
* Run testthat::snapshot_review('derive_blfl') to interactively review the change.

── Failure (test-derive_blfl.R:74:3): derive_blfl sdmt_in validations work ─────
Snapshot of `derive_blfl(...)` has changed:
old vs new
- Required variables `VSORRES`, `VSSTAT`, `VSTESTCD` and `VSDTC` are missing
+ Required variables `VSORRES`, `VSSTAT`, `VSTESTCD`, and `VSDTC` are missing in `sdtm_in`

* Run testthat::snapshot_accept('derive_blfl') to accept the change.
* Run testthat::snapshot_review('derive_blfl') to interactively review the change.

@ShiyuC
Copy link
Collaborator Author

ShiyuC commented Jul 24, 2024

@ShiyuC: great job! Thank you so much.

I think the only remaining bit is really to fix the test failures from the testing of derive_blfl(). But I am guessing Kamil or Ram are better equipped to give you feedback here as they worked on this function.

And also still on derive_blfl(), I would convert expect_snapshot_error() to expect_snapshot(..., error = TRUE) as expect_snapshot_error() is under "questioning" status (check its documentation).

Test failures related to derive_blfl()

==> Testing R file using 'testthat'Loading sdtm.oak
[ FAIL 8 | WARN 0 | SKIP 0 | PASS 7 ]

── Failure (test-derive_blfl.R:47:3): derive_blfl sdmt_in validations work ─────
Snapshot of `derive_blfl(...)` has changed:
old vs new
- Required variable `DOMAIN` is missing
+ Required variable `DOMAIN` is missing in `sdtm_in`

* Run testthat::snapshot_accept('derive_blfl') to accept the change.
* Run testthat::snapshot_review('derive_blfl') to interactively review the change.

── Failure (test-derive_blfl.R:58:3): derive_blfl sdmt_in validations work ─────
Snapshot of `derive_blfl(...)` has changed:
old vs new
- Required variables `oak_id`, `raw_source` and `patient_number` are missing
+ Required variables `oak_id`, `raw_source`, and `patient_number` are missing in `sdtm_in`

* Run testthat::snapshot_accept('derive_blfl') to accept the change.
* Run testthat::snapshot_review('derive_blfl') to interactively review the change.

── Failure (test-derive_blfl.R:74:3): derive_blfl sdmt_in validations work ─────
Snapshot of `derive_blfl(...)` has changed:
old vs new
- Required variables `VSORRES`, `VSSTAT`, `VSTESTCD` and `VSDTC` are missing
+ Required variables `VSORRES`, `VSSTAT`, `VSTESTCD`, and `VSDTC` are missing in `sdtm_in`

* Run testthat::snapshot_accept('derive_blfl') to accept the change.
* Run testthat::snapshot_review('derive_blfl') to interactively review the change.

Confirmed that the failed test will be addressed in a separate PR.

@ShiyuC
Copy link
Collaborator Author

ShiyuC commented Jul 24, 2024

@rammprasad I'm still not authorized to merge this PR after all conversations and conflicts are resolved.

@galachad
Copy link
Member

galachad commented Jul 24, 2024

@rammprasad I'm still not authorized to merge this PR after all conversations and conflicts are resolved.

@ShiyuC I will merge this PR, we can check in another one why.

@galachad galachad merged commit 6862b84 into main Jul 24, 2024
12 of 13 checks passed
@galachad galachad deleted the 0063-unexported-fns branch July 24, 2024 22:56
@kamilsi
Copy link
Collaborator

kamilsi commented Jul 29, 2024

EDIT: nevermind, I see that @galachad fixed this in #73, thanks (and indeed it was caused by admiraldev)!

I think the only remaining bit is really to fix the test failures from the testing of derive_blfl(). But I am guessing Kamil or Ram are better equipped to give you feedback here as they worked on this function.

Hi @ramiromagno, the changes in test behavior are not justified by any codebase changes in this PR. Perhaps admiraldev was updated on the machine where the tests were run, allowing it to identify the object where the problem is detected. Regardless, these are good changes and should be accepted using testthat::snapshot_accept('derive_blfl').

Confirmed that the failed test will be addressed in a separate PR.

@ShiyuC which issue is that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Examples for unexported functions
5 participants