Refactor the assertion in colorize_result() to improve test coverage