Add tests for format.py and clean code

Remove unnecessary print statements and add exception ceration for the
main function that replaces and formats the SVG file.