pytest --cov has revolutionized how I work.

Rev 41ac1b in the fstrings branch now contains unit tests that cover 100% 
of the TOG, TOT, Fstringify and Orange branches.

What's revolutionary is the interaction between coverage and the code being 
tested. Over and over again I realized that uncovered code wasn't needed. I 
just removed it! This is *completely safe*, because...

If errors are discovered later one or more unit tests will be added, along 
with new code. Running all unit tests will ensure that all code, both old 
and new, work as expected. Furthermore, running all unit tests will reveal 
places where code becomes dead, as far as the unit tests are concerned. But 
removing dead code is *complete safe*, because...

In TDD we assume the unit tests are the last word. If they pass then by 
*definition* all is well.

*Summary*

Up until now, I have always *hoped* that unit tests were strong enough. 
Coverage testing eliminates all reliance on hope.

Once unit tests cover 100% of the code, *any* changes to the code should be 
valid, provided that:

a) All unit tests still pass *and*
b) All code remains covered.

The last two days have been some of the most productive of my life. All 
worry has been removed. Covering 100% of the code in unit tests is a 
stronger test than I ever dreamed possible. The freedom this creates is 
comparable to the difference in safety between C and python.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/741bd347-5810-4fd3-8fb6-4078cb220e9a%40googlegroups.com.

Reply via email to