summaryrefslogtreecommitdiff
path: root/tests/format/elf/non_existing_binary.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/format/elf/non_existing_binary.py')
-rw-r--r--tests/format/elf/non_existing_binary.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/tests/format/elf/non_existing_binary.py b/tests/format/elf/non_existing_binary.py
index 47c9028..6111f03 100644
--- a/tests/format/elf/non_existing_binary.py
+++ b/tests/format/elf/non_existing_binary.py
@@ -5,22 +5,20 @@
# Eprouve quelques mécanismes de construction côté Python.
-import pychrysalide
-
+from chrysacase import ChrysalideTestCase
from pychrysalide.analysis.contents import FileContent
from pychrysalide.format.elf import ElfFormat
-cnt = FileContent("non_existing_binary")
-print(cnt)
+class TestNonExistingBinary(ChrysalideTestCase):
+ """TestCase for non existent binary loading."""
-print(cnt == None)
+ def testNonExistent(self):
+ """Try to load a non existent binary without crashing."""
-try:
- fmt = ElfFormat(cnt)
-except TypeError as e:
- fmt = None
+ cnt = FileContent('non_existing_binary')
+ self.assertIsNone(cnt)
-print(fmt)
+ with self.assertRaisesRegex(TypeError, 'The argument must be an instance of BinContent.'):
-print(fmt == None)
+ fmt = ElfFormat(cnt)