Reformat new test and add comment header
authorEli Bendersky <eliben@gmail.com>
Sat, 25 Feb 2017 15:53:16 +0000 (07:53 -0800)
committerEli Bendersky <eliben@gmail.com>
Sat, 25 Feb 2017 15:53:16 +0000 (07:53 -0800)
test/test_stab.py

index 83067b8f8998a32de4a56c673c2ac85c1f3d65a2..7180b2a006a26412a0fc345eb5aefc5747038341 100644 (file)
@@ -1,3 +1,9 @@
+#-------------------------------------------------------------------------------
+# elftools tests
+#
+# Eli Bendersky (eliben@gmail.com)
+# This code is in the public domain
+#-------------------------------------------------------------------------------
 try:
     import unittest2 as unittest
 except ImportError:
@@ -8,13 +14,13 @@ from utils import setup_syspath; setup_syspath()
 from elftools.elf.elffile import ELFFile
 from elftools.elf.sections import StabSection
 
+
 class TestStab(unittest.TestCase):
     def test_stab(self):
         expected = [
             ("obj_stabs.S", 0, 0, 0x2, 33), # generated by compiler
             ("label", 0x95, 0xc8, 0x4072, 0xdeadbeef),
-            ("another label", 0x41, 0x66, 0xf9b1, 0xcafebabe),
-            ]
+            ("another label", 0x41, 0x66, 0xf9b1, 0xcafebabe)]
         with open(os.path.join('test', 'testfiles_for_unittests',
                                'obj_stabs.elf'), 'rb') as f:
             elf = ELFFile(f)
@@ -22,17 +28,18 @@ class TestStab(unittest.TestCase):
             # using correct type?
             for s in elf.iter_sections():
                 if s.name == '.stab':
-                    self.assertIsInstance (s, StabSection)
+                    self.assertIsInstance(s, StabSection)
 
             # check section contents
             stab = elf.get_section_by_name('.stab')
             stabstr = elf.get_section_by_name('.stabstr')
-            for entry, golden in zip (stab.iter_stabs (), expected):
-                self.assertEqual(stabstr.get_string (entry.n_strx), golden[0])
+            for entry, golden in zip(stab.iter_stabs(), expected):
+                self.assertEqual(stabstr.get_string(entry.n_strx), golden[0])
                 self.assertEqual(entry.n_type, golden[1])
                 self.assertEqual(entry.n_other, golden[2])
                 self.assertEqual(entry.n_desc, golden[3])
                 self.assertEqual(entry.n_value, golden[4])
 
+
 if __name__ == '__main__':
     unittest.main()