def test_nt_headers_exception(self):
        """pefile should fail parsing invalid data (missing NT headers)"""

        # Take a known good file.
        control_file = os.path.join(REGRESSION_TESTS_DIR, "MSVBVM60.DLL")
        pe = pefile.PE(control_file, fast_load=True)

        # Truncate it at the PE header and add invalid data.
        pe_header_offest = pe.DOS_HEADER.e_lfanew
        self.assertIsNotNone(pe.__data__)
        if pe.__data__:
            corrupted_data = pe.__data__[:pe_header_offest] + b"\0" * (1024 * 10)

            self.assertRaises(pefile.PEFormatError, pefile.PE, data=corrupted_data)
pefile should fail parsing invalid data (missing NT headers)
tests/pefile_test.py