concept stemmer ( ) function in category python

appears as: The stemmer() function, stemmer() function
Tiny Python Projects: Learn coding and testing with puzzles and games

This is an excerpt from Manning's book Tiny Python Projects: Learn coding and testing with puzzles and games.

This function will also pass the test_stemmer() function. By writing a test just for the idea of this one function, and exercising it with all the different values I would expect, I’m free to refactor my code. In my mind, the stemmer() function is a black box. What goes on inside the function is of no concern to the code that calls it. As long as the function passes the tests, it is “correct” (for certain values of “correct”).

Small functions and their tests will set you free to improve your programs. First make something work, and make it beautiful. Then try to make it better, using your tests to ensure it keeps working as expected.