Skip to content

expect_equals(a,b,0.01) silently ignores 0.01 from v0.10.1 #294

@mattdowle

Description

@mattdowle

v0.9.1 : expected behaviour

> expect_equal(415, 416, 0.01)
> expect_equal(415, 416, tolerance=0.01)

v0.10.0 May 2015, currently on CRAN

> expect_equal(415, 416, 0.01)   # 0.01 silently not passed on to all.equal, apparently
Error: 415 not equal to 416
416 - 415 == 1
> expect_equal(415, 416, tolerance=0.01)   # tolerance= now required.

We all know we should always name our arguments. Anyone who hasn't may now be bitten by this when they upgrade. It's the silent apparent ignoring of the 3rd argument that's confusing. ?expect_equals contains ... = other values passed to all.equal and when you then look at ?all.equal it seems reasonable to assume the 3rd argument matches up with the 3rd argument of all.equal (i.e. tolerance).

A few solutions I can think of are i) restoring previous behaviour, ii) catch and warn/error about any unnamed arguments or iii) add to ?expect_equals that tolerance must now be explicitly named.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions