summaryrefslogtreecommitdiff
path: root/tests/format/elf/non_existing_binary.py
blob: 6111f03736127939fa177f1cf7450a208c2c28c6 (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, 'The argument must be an instance of BinContent.'):

            fmt = ElfFormat(cnt)