39 """Return ``CC^2 * (1 - coverage)^3 + CC``.
41 Complexity is a positive integer and coverage is a fraction in the
42 inclusive range zero through one. Failing fast on invalid measurements
43 prevents the reporting layer from presenting approximate scores.
45 if isinstance(complexity, bool)
or not isinstance(complexity, int):
46 raise TypeError(
"complexity must be an integer")
48 raise ValueError(
"complexity must be at least 1")
49 if not 0.0 <= coverage <= 1.0:
50 raise ValueError(
"coverage must be between 0.0 and 1.0")
51 uncovered = 1.0 - coverage
52 return float(complexity**2 * uncovered**3 + complexity)