if the function you have could read from a file object (as opposed to a path) it would make it easier to test because now your only requirement would be to create a file object, not to write to a path.