Skip to content

assert.InEpsilon has inconsistent results with expected or actual values of Inf #1662

Closed

Description

@brackendawson
func TestInEpsilon1(t *testing.T) {
	div := 0.0
	require.InEpsilon(t, 1, 1/div, 0.001)
}

func TestInEpsilon2(t *testing.T) {
	div := 0.0
	require.InEpsilon(t, 1/div, 1, 0.001)
}
> go test -v -run InEps | grep -E '(PASS|FAIL)'
--- FAIL: TestInEpsilon1 (0.00s)
--- PASS: TestInEpsilon2 (0.00s)

Originally posted by @ybrustin-te in #918 (comment)

Given the difference between two Inf values cannot be determined, those assertions should both fail.

Activity

  1. added a commit that references this issue on Oct 16, 2024
  2. added a commit that references this issue on Oct 26, 2024
  3. added a commit that references this issue on Apr 5, 2025
  4. changed the title [-]InEpsilon has inconsistent results with expected or actual values of Inf[/-] [+]assert.InEpsilon has inconsistent results with expected or actual values of Inf[/+] on May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions