pharmaverse / admiral

ADaM in R Asset Library
https://pharmaverse.github.io/admiral
Apache License 2.0
220 stars 61 forks source link

Closes #2377 Added unit tests #2414

Closed StefanThoma closed 4 months ago

StefanThoma commented 4 months ago

Added assertion to dt_level function to deal with unexpected inputs

Thank you for your Pull Request! We have developed this task checklist from the Development Process Guide to help with the final steps of the process. Completing the below tasks helps to ensure our reviewers can maximize their time on your code as well as making sure the admiral codebase remains robust and consistent.

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 main branch until you have checked off each task.

StefanThoma commented 4 months ago

I get a strange error in the test suite apparently independent of my code:

Error in derive_param_tte(): ! For some values of "PARAMCD" there is more than one value of "AEDECOD" ℹ Call get_one_to_many_dataset() to get all one-to-many values.

Where the test expects the error as: regexp = paste0( "For some values of PARAMCD there is more than one value of AEDECOD.\n", "Call get_one_to_many_dataset() to get all one to many values." )

I can replace this with a snapshot test, maybe!

StefanThoma commented 4 months ago

There appears also a deprecation warning:

Warning ('test-derive_param_tte.R:45:3'): derive_param_tte Test 1: new observations with analysis date are derived correctly ── enumerate() was deprecated in admiraldev 1.1.0.

github-actions[bot] commented 4 months ago

Code Coverage

Package Line Rate Health
admiral 98%
Summary 98% (4732 / 4820)
bundfussr commented 4 months ago

There appears also a deprecation warning:

Warning ('test-derive_param_tte.R:45:3'): derive_param_tte Test 1: new observations with analysis date are derived correctly ── enumerate() was deprecated in admiraldev 1.1.0.

I'm currently trying to fix these in https://github.com/pharmaverse/admiral/issues/2413.

StefanThoma commented 4 months ago

@zdz2101 I have added an assert statement into dt_level. I believe this is consistent with what input we would expect, i.e. a character scalar of one of the options. Can you confirm?