A function returns the wrong value, an endpoint crashes on certain input, or code stopped working after a library update. I first write a test that reproduces the bug, then fix the code until that test passes and your existing tests still pass. You see the proof: the new test fails on the old code and passes on the new one. In the larger packages I add tests for the module and can replace an outdated library while keeping the behavior identical, checked by tests run before and after. You get a patch or pull request, the tests and a short explanation of the cause.