It can both help someone understand the function easier by seeing a plot in the source while also serving as a test.