def testGetFlagFile(self): flags_file = jscompiler._GetFlagFile( ['path/to/src1.js', 'path/to/src2.js'], ['--test_compiler_flag']) def file_get_contents(filename): with open(filename) as f: content = f.read() f.close() return content flags_file_content = file_get_contents(flags_file.name) os.remove(flags_file.name) self.assertEqual( '--js path/to/src1.js --js path/to/src2.js --test_compiler_flag', flags_file_content)