Skip to content

expect_equal() fails for numeric vectors containing Inf values #789

@andypea

Description

@andypea

Calls to expect_equal() fail whenever the values to be compared are numeric vectors with coincident entries having the value Inf. For example, on my machine, the following code:

library(testthat) expect_equal(c(0, Inf), c(1, Inf))

produces the error:

Error in is.character(message) : missing value where TRUE/FALSE needed

This should probably be fixed by handling Inf values explicitly in the function vector_equal_tol(), making the result consistent with a call to vector_equal(). Alternatively, mismatch_numeric() could be altered, so that it handles a diff argument containing entries which are neither TRUE nor FALSE.

expect_equal_inf_bug.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorexpectation 🙀

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions