import os
import unittest

import transpiler

class TestTranspiler:

    def test_transpiler_creates_files_without_format(self):
        transpiler.main(["--output-dir", "/tmp"])

        assert os.path.isfile("/tmp/auto_functions.cpp")
        assert os.path.isfile("/tmp/auto_functions.h")

    def test_transpiler_creates_files_with_format(self):
        transpiler.main(["--format", "--output-dir", "/tmp"])

        assert os.path.isfile("/tmp/auto_functions.cpp")
        assert os.path.isfile("/tmp/auto_functions.h")

@@ -114,32 +114,193 @@
 t_format(self):%0A
+        try:%0A            os.remove(%22/tmp/auto_functions.cpp%22)%0A            os.remove(%22/tmp/auto_functions.h%22)%0A        except FileNotFoundError:%0A            pass%0A%0A
         transpil
@@ -496,32 +496,193 @@
 h_format(self):%0A
+        try:%0A            os.remove(%22/tmp/auto_functions.cpp%22)%0A            os.remove(%22/tmp/auto_functions.h%22)%0A        except FileNotFoundError:%0A            pass%0A%0A
         transpil

Make transpiler test remove files if they already exist