def setUp(self): self.file = x.ExeFile(full_path(self.path))
def test_no_pe_signature(self): with self.assertRaises(x.BrokenFileError) as exc: x.ExeFile(full_path('examples/NoPESignature.exe')) self.assertIn('Broken File. No "PE\\0\\0" in begin of PEHeader', str(exc.exception))
def test_wrong_file_format(self): with self.assertRaises(x.BrokenFileError) as excInfo: x.ExeFile(full_path('index.py')) self.assertIn('Broken file. No "MZ" in begin', str(excInfo.exception))
def test_no_mz_signature(self): with self.assertRaises(x.BrokenFileError) as exc: x.ExeFile(full_path('examples/NoMZSignature.exe')) self.assertIn('Broken file. No "MZ" in begin', str(exc.exception))
def test_file_not_found(self): self.assertRaises(FileNotFoundError, lambda: x.ExeFile( full_path('WrongPath/nofile.exe')))