Take a file instead of filename.
Use doctest.