testify icon indicating copy to clipboard operation
testify copied to clipboard

assert: Add new assertion InEpsilonMapValues

Open hendrywiranto opened this issue 2 years ago • 3 comments

Summary

Add new assertion InEpsilonMapValues which is the same as InEpsilon, but it compares all values between two maps.

Changes

  • Add new assertion InEpsilonMapValues

Motivation

Quoting https://github.com/stretchr/testify/issues/1497

To be consistent with InDeltaMapValues package could provide InEpsilonMapValues

Example

expected := map[string]float64{
	"foo": 2.2,
	"baz": 2.0,
}
actual := map[string]float64{
	"foo": 2.1,
	"baz": 2.1,
}
InEpsilonMapValues(mockT, expected, actual, 0.06, "InEpsilonMapValues example")

Related issues

Closes https://github.com/stretchr/testify/issues/1497

hendrywiranto avatar Nov 01 '23 12:11 hendrywiranto

@hendrywiranto, hi!

I am not maintainer of testify and cannot approve or decline your MR. But LGTM.

(cc) @dolmen

Antonboom avatar Nov 03 '23 09:11 Antonboom

@hendrywiranto, hi!

I am not maintainer of testify and cannot approve or decline your MR. But LGTM.

(cc) @dolmen

Yep I know, thanks for replying tho Looks like the checks failure is a widespread issue and being handled here https://github.com/stretchr/testify/pull/1504

hendrywiranto avatar Nov 03 '23 15:11 hendrywiranto

FYI, my focus is on fixing bugs, not on extending the API to have even more code to maintain.

dolmen avatar Nov 05 '23 09:11 dolmen