python / python/cpython

Increase test coverage for math.py fabs() function

Open
#149,059 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

tests type-feature
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

In Lib/test/test_math.py, the testFabs() method tests integers but not infinity (especially negative infinity).

def testFabs(self):
        self.assertRaises(TypeError, math.fabs)
        self.ftest('fabs(-1)', math.fabs(-1), 1)
        self.ftest('fabs(0)', math.fabs(0), 0)
        self.ftest('fabs(1)', math.fabs(1), 1)

I have submitted a PR that increases test coverage for fabs().

Linked PRs
  • gh-149060
  • gh-149061
  • gh-150940

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open Lib/test/test_math.py and inspect testFabs() and the existing ftest helper. Compare the linked PRs for the intended infinity cases; done means the fabs() tests cover the reported missing behavior and pass in the math test suite.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Feature
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.