diff --git a/spec/python/test_debug_enum_name.py b/spec/python/test_debug_enum_name.py index 2421f2953..554d05382 100644 --- a/spec/python/test_debug_enum_name.py +++ b/spec/python/test_debug_enum_name.py @@ -4,7 +4,6 @@ class TestDebugEnumName(unittest.TestCase): def test_debug_enum_name(self): - r = DebugEnumName.from_file("src/fixed_struct.bin") - - # this test is meaningful only for languages that have --debug and do - # not save enum type info + with DebugEnumName.from_file('src/fixed_struct.bin') as r: + # this test is meaningful only for languages that have --debug and do + # not save enum type info diff --git a/spec/python/test_switch_cast.py b/spec/python/test_switch_cast.py index 8f9b3f3cf..a0a8f9268 100644 --- a/spec/python/test_switch_cast.py +++ b/spec/python/test_switch_cast.py @@ -4,8 +4,7 @@ class TestSwitchCast(unittest.TestCase): def test_switch_cast(self): - r = SwitchCast.from_file("src/switch_opcodes.bin") - - self.assertEqual(r.first_obj.value, "foobar") - self.assertEqual(r.second_val, 0x42) - # unable to test "err_cast" here + with SwitchCast.from_file('src/switch_opcodes.bin') as r: + self.assertEqual(r.first_obj.value, "foobar") + self.assertEqual(r.second_val, 0x42) + # unable to test "err_cast" here