diff --git a/gdb-port/tests/unit/ast.py b/gdb-port/tests/unit/ast.py index 77f26474b8b654674ebdc7bfe908eb78d5eadbe4..90a448060d40a49fb4e22a0d84351b5f415d78ba 100644 --- a/gdb-port/tests/unit/ast.py +++ b/gdb-port/tests/unit/ast.py @@ -10,7 +10,7 @@ class HParseResultCreation(unittest.TestCase): gdbv_patcher = unittest.mock.patch('gdb.Value', autospec=True) hpt_patcher.start() gdbv_patcher.start() - mocked_hparseresult = HParseResult(0xdeadbeef) + __class__.mocked_hparseresult = HParseResult(0xdeadbeef) gdbv_patcher.stop() hpt_patcher.stop() @@ -21,6 +21,11 @@ class HParseResultCreation(unittest.TestCase): with self.assertRaises(ValueError): res = HParseResult(0) - #@patch("HParsedToken") - #def test_make_HParsedToken(self): - # with patch.object(HParseResult, "read_member", return_value=0xdeadbeef): + #TODO: Mocking the read_member method might be needed + #TODO: MagicMock breaks self.token_type comparison + def test_make_HParsedToken(self): + gdbv_patcher = unittest.mock.patch('gdb.Value', autospec=True) + gdbv_patcher.start() + hpr = HParseResult(0xdeadbeef) + tok = hpr.make_HParsedToken() + gdbv_patcher.stop()