def test_load(): """Ensure Programs can be constructed from saved files.""" tu = get_tu('int foo();') assert len(tu.diagnostics) == 0 path = save_tu(tu) assert os.path.exists(path) assert os.path.getsize(path) > 0 tu2 = Program.from_ast_file(filename=path) assert len(tu2.diagnostics) == 0 foo = get_cursor(tu2, 'foo') assert foo is not None # Just in case there is an open file descriptor somewhere. del tu2 os.unlink(path)