Skip to content

Fix for upcoming testthat 3.3.0#30

Merged
zhanxw merged 1 commit intozhanxw:masterfrom
hadley:testthat-3.3.0
Oct 1, 2025
Merged

Fix for upcoming testthat 3.3.0#30
zhanxw merged 1 commit intozhanxw:masterfrom
hadley:testthat-3.3.0

Conversation

@hadley
Copy link
Contributor

@hadley hadley commented Sep 30, 2025

Looks like you accidentally used expect() instead of expect_true() in a couple of places

Looks like you accidentally used `expect()` instead of `expect_true()` in a couple of places
@gemini-code-assist
Copy link

Summary of Changes

Hello @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 testthat 3.3.0 release by updating specific test assertions. The change ensures that existing tests continue to function correctly, preventing potential failures when the new version of testthat is adopted.

Highlights

  • Test Compatibility: Updated testthat assertions from expect() to expect_true() in two test cases within test-vcf.R to ensure compatibility with the upcoming testthat 3.3.0 release.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

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)

Choose a reason for hiding this comment

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

medium

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)

Choose a reason for hiding this comment

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

medium

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))

Copy link
Owner

@zhanxw zhanxw left a comment

Choose a reason for hiding this comment

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

Use expect_true instead of expect.

@zhanxw zhanxw merged commit a8922d1 into zhanxw:master Oct 1, 2025
8 of 9 checks passed
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.

2 participants