fix: Goal state pickling/unpickling

This commit is contained in:
Leni Aniva 2024-12-11 16:54:50 -08:00
parent fb8652d132
commit f1e3ec82f0
Signed by: aniva
GPG Key ID: 4D9B1C8D10EA4C50
2 changed files with 10 additions and 5 deletions

View File

@ -314,15 +314,20 @@ class Server:
}) })
if "error" in result: if "error" in result:
raise ServerError(result["desc"]) raise ServerError(result["desc"])
def goal_load(self, path: str) -> int: def goal_load(self, path: str) -> GoalState:
# FIXME: Load the entire state
result = self.run('goal.load', { result = self.run('goal.load', {
"path": path, "path": path,
}) })
if "error" in result: if "error" in result:
raise ServerError(result["desc"]) raise ServerError(result["desc"])
state_id = result['id'] state_id = result['id']
return state_id result = self.run('goal.print', {
'stateId': state_id,
'goals': True,
})
if "error" in result:
raise ServerError(result["desc"])
return GoalState.parse(result, self.to_remove_goal_states)
def get_version(): def get_version():
@ -336,7 +341,7 @@ def get_version():
class TestServer(unittest.TestCase): class TestServer(unittest.TestCase):
def test_version(self): def test_version(self):
self.assertEqual(get_version(), "0.2.22") self.assertEqual(get_version(), "0.2.23")
def test_expr_type(self): def test_expr_type(self):
server = Server() server = Server()

2
src

@ -1 +1 @@
Subproject commit 5d76626912795579832f2bb43748e137bb6d0595 Subproject commit 3744cfaa9608cd43e00078283339662b3720949b