When test cases come from the specification instead of the code, why does the suite survive a total rewrite of the function's internals?
Short drills on what this video just taught. Write the code, run the checks, and reveal the answer only if you are stuck.
Black box testing reads the docstring and nothing else. Here is the entire specification you are allowed to see:
def sqrt(x, epsilon): """assumes x, epsilon floats, x >= 0, epsilon > 0 returns res such that x-epsilon <= res*res <= x+epsilon"""
Someone has proposed six (x, epsilon) pairs as test cases in candidates. Some of them ask the function for something its author never promised. Keep only the pairs the specification allows, leaving them in the order they are listed, and assign that list to in_contract.