Skip to content

Ignore ValueError, TypeError and NotImplementedError in coverage #31

@carlos-adir

Description

@carlos-adir

Some functions raises errors like ValueError and TypeError.

Although they are important to be included in tests, most of the raisers are only verification of the functions' inputs. Example:

def binom(n: int, i: int) -> int:
    """Computes the binom (n, i)"""
    if not isinstance(n, int) or not isinstance(i, int):
        raise ValueError("n and i must be integers")
    return factorial(n) // (factorial(n-i) * factorial(i))

def factorial(n: int) -> int:
    """Computes the factorial of n"""
    if not isinstance(n, int) or n < 0:
        raise ValueError("n must be integer >= 0")
    return math.factorial(n)

The intention is to ignore these cases in the coverage.

Metadata

Metadata

Assignees

Labels

refactorTasks to improve readability / performance

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions