Fix formatting and add comment in test
authorEli Bendersky <eliben@gmail.com>
Wed, 8 Jul 2020 00:44:33 +0000 (17:44 -0700)
committerEli Bendersky <eliben@gmail.com>
Wed, 8 Jul 2020 00:44:33 +0000 (17:44 -0700)
test/test_dwarf_expr.py

index 1e9949e0e31b357e7842f01e9ee9cffd0c286390..308d87289556d18ec2dd2bbc3ef6b029d1cd51a6 100644 (file)
@@ -53,11 +53,11 @@ class TestExprDumper(unittest.TestCase):
         self.assertEqual(self.visitor.dump_expr([0x1d, 0x1e, 0x1d, 0x1e, 0x1d, 0x1e]),
             'DW_OP_mod; DW_OP_mul; DW_OP_mod; DW_OP_mul; DW_OP_mod; DW_OP_mul')
 
+        # 0xe0 maps to both DW_OP_GNU_push_tls_address and DW_OP_lo_user, so
+        # check for both to prevent non-determinism.
         self.assertIn(self.visitor.dump_expr([0x08, 0x0f, 0xe0]),
                       ('DW_OP_const1u: 15; DW_OP_GNU_push_tls_address',
-                       'DW_OP_const1u: 15; DW_OP_lo_user',
-                       )
-                      )
+                       'DW_OP_const1u: 15; DW_OP_lo_user'))
 
 
 class TestParseExpr(unittest.TestCase):
@@ -79,10 +79,11 @@ class TestParseExpr(unittest.TestCase):
 
         lst = p.parse_expr([0xe0])
         self.assertEqual(len(lst), 1)
+        # 0xe0 maps to both DW_OP_GNU_push_tls_address and DW_OP_lo_user, so
+        # check for both to prevent non-determinism.
         self.assertIn(lst[0], [
             DWARFExprOp(op=0xe0, op_name='DW_OP_GNU_push_tls_address', args=[]),
-            DWARFExprOp(op=0xe0, op_name='DW_OP_lo_user', args=[])
-        ])
+            DWARFExprOp(op=0xe0, op_name='DW_OP_lo_user', args=[])])
 
 
 if __name__ == '__main__':