summaryrefslogtreecommitdiff
path: root/tests/format/elf/non_existing_binary.py
blob: c98434424d63f35a47e181aaf13f71d0c32ef838 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/python
# -*- coding: utf-8 -*-


# Eprouve quelques mécanismes de construction côté Python.


from chrysacase import ChrysalideTestCase
from pychrysalide.analysis.contents import FileContent
from pychrysalide.format.elf import ElfFormat


class TestNonExistingBinary(ChrysalideTestCase):
    """TestCase for non existent binary loading."""

    def testNonExistent(self):
        """Try to load a non existent binary without crashing."""

        cnt = FileContent('non_existing_binary')
        self.assertIsNone(cnt)

        with self.assertRaisesRegex(TypeError, 'argument 1 must be pychrysalide.analysis.BinContent, not None'):

            fmt = ElfFormat(cnt)