Conversation
Looks like you accidentally used `expect()` instead of `expect_true()` in a couple of places
Summary of ChangesHello @hadley, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an incompatibility with the upcoming Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly updates the test suite to be compatible with the upcoming testthat 3.3.0 release by replacing the deprecated expect() with expect_true(). The changes are accurate and address the issue described.
I've also included a couple of suggestions to make the updated tests more robust by checking for the actual creation of the index files, which more directly verifies the functions' behavior. Overall, this is a good maintenance update.
| fileName = system.file("vcf/all.anno.filtered.extract.vcf.gz", package = "seqminer") | ||
| cfh <- createSingleChromosomeVCFIndex(fileName, indexFileName = tempfile()) | ||
| expect(nchar(cfh) > 0) | ||
| expect_true(nchar(cfh) > 0) |
There was a problem hiding this comment.
While changing expect() to expect_true() is correct for the upcoming testthat version, the test itself could be more robust. Currently, it only checks if the returned file path is a non-empty string. A better test would be to verify that the index file was actually created, as this is the function's primary purpose.
To avoid a potential error from file.exists(NULL) if the function returns NULL on failure, it's good practice to check for NULL first.
expect_true(!is.null(cfh) && file.exists(cfh))| fileName = system.file("vcf/all.anno.filtered.extract.headerFixed.bcf.gz", package = "seqminer") | ||
| cfh <- createSingleChromosomeBCFIndex(fileName, indexFileName = tempfile()) | ||
| expect(nchar(cfh) > 0) | ||
| expect_true(nchar(cfh) > 0) |
There was a problem hiding this comment.
Similar to my other comment, this test can be made more robust. Instead of just checking that the returned file path string has a length greater than zero, it would be better to assert that the index file was actually created on disk. This more directly tests the function's behavior.
Checking for NULL first also makes the test safer against potential errors if the function fails.
expect_true(!is.null(cfh) && file.exists(cfh))
zhanxw
left a comment
There was a problem hiding this comment.
Use expect_true instead of expect.
Looks like you accidentally used
expect()instead ofexpect_true()in a couple of places