DRY, string, and unit testing
- by Rodrigue
I have a recurring question when writing unit tests for code that involves constant string values.
Let's take an example of a method/function that does some processing and returns a string containing a pre-defined constant. In python, that would be something like:
STRING_TEMPLATE = "/some/constant/string/with/%s/that/needs/interpolation/"
def…