9
9
10
10
class TestDBGFile (unittest .TestCase ):
11
11
def test_dynamic_segment (self ):
12
- """
13
- Test that the degenerate case for the dynamic segment does not crash
12
+ """ Test that the degenerate case for the dynamic segment does not crash
14
13
"""
15
14
with open (os .path .join ('test' , 'testfiles_for_unittests' ,
16
15
'debug_info.elf' ), 'rb' ) as f :
17
16
elf = ELFFile (f )
18
17
19
18
seen_dynamic_segment = False
20
19
for segment in elf .iter_segments ():
21
- if segment .header .p_type != 'PT_DYNAMIC' :
22
- continue
23
-
24
- self .assertEqual (segment .num_tags (), 0 , "The dynamic segment in this file should be empty" )
25
- seen_dynamic_segment = True
26
- break
20
+ if segment .header .p_type == 'PT_DYNAMIC' :
21
+ self .assertEqual (segment .num_tags (), 0 , "The dynamic segment in this file should be empty" )
22
+ seen_dynamic_segment = True
23
+ break
27
24
28
25
self .assertTrue (seen_dynamic_segment , "There should be a dynamic segment in this file" )
29
26
30
27
def test_dynamic_section (self ):
31
- """
32
- Test that the degenerate case for the dynamic section does not crash
28
+ """ Test that the degenerate case for the dynamic section does not crash
33
29
"""
34
30
with open (os .path .join ('test' , 'testfiles_for_unittests' ,
35
31
'debug_info.elf' ), 'rb' ) as f :
@@ -39,8 +35,7 @@ def test_dynamic_section(self):
39
35
self .assertEqual (section .num_tags (), 0 , "The dynamic section in this file should be empty" )
40
36
41
37
def test_eh_frame (self ):
42
- """
43
- Test that parsing .eh_frame with SHT_NOBITS does not crash
38
+ """ Test that parsing .eh_frame with SHT_NOBITS does not crash
44
39
"""
45
40
with open (os .path .join ('test' , 'testfiles_for_unittests' ,
46
41
'debug_info.elf' ), 'rb' ) as f :
0 commit comments