Skip to content

Add additional tests for isinf() function in cmath library #148868

Closed

Description

Feature or enhancement

Proposal:

In Lib/test/test_cmath.py , under the test_isinf() method , many test cases for isinf method are available but edge cases like -inf and inf/inf seems to be missing.

def test_isinf(self):
        self.assertFalse(cmath.isinf(1))
        self.assertFalse(cmath.isinf(1j))
        self.assertFalse(cmath.isinf(NAN))
        self.assertTrue(cmath.isinf(INF))
        self.assertTrue(cmath.isinf(complex(INF, 0)))
        self.assertTrue(cmath.isinf(complex(0, INF)))
        self.assertTrue(cmath.isinf(complex(INF, INF)))
        self.assertTrue(cmath.isinf(complex(NAN, INF)))
        self.assertTrue(cmath.isinf(complex(INF, NAN)))

I have opened a PR adding 2 test cases for -inf and inf/inf

Has this already been discussed elsewhere?

No

Links to previous discussion of this feature:

Linked PRs

Activity

  1. ghost added
    type-featureA feature request or enhancement
    on Apr 22, 2026
  2. skirpichev commented on Apr 22, 2026

    @skirpichev
    Member

    inf/inf is nan - it's present.

    Note also, that isinf has much more tests, it's used in rAssertAlmostEqual.

  3. added a commit that references this issue on Apr 27, 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

    testsTests in the Lib/test dirtype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions