Complete worked example
python
def eligible(years):
return years >= 2
def test_below_threshold():
assert eligible(1) is False
def test_above_threshold():
assert eligible(3) is True- Reasoning
- The worked example checks one year and three years, making both branches visible before the boundary exercise. The implementation uses >= 2. In the playground, pytest --collect-only lists the named tests without running their assertions; pytest -q then performs the actual run. For this first exercise the module is flat and imports no application package. In larger projects use an installed package or a deliberate import layout rather than modifying sys.path randomly. Discovery and import problems should be repaired explicitly, not hidden with broad exception handling.