From 1a8275428af6602f24a7d3c412dc337d8f40b40b Mon Sep 17 00:00:00 2001 From: Lorenzo Curcio Date: Tue, 3 Dec 2024 10:41:23 +0100 Subject: [PATCH] minor error in docs Signed-off-by: Lorenzo Curcio --- daprdocs/content/en/python-sdk-docs/python-actor.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/daprdocs/content/en/python-sdk-docs/python-actor.md b/daprdocs/content/en/python-sdk-docs/python-actor.md index 7c87948f..5a5ae0fc 100644 --- a/daprdocs/content/en/python-sdk-docs/python-actor.md +++ b/daprdocs/content/en/python-sdk-docs/python-actor.md @@ -71,13 +71,13 @@ from dapr.actor.runtime.mock_actor import create_mock_actor class MyActor(Actor, MyActorInterface): async def save_state(self, data) -> None: - await self._state_manager.set_state('state', data) + await self._state_manager.set_state('mystate', data) await self._state_manager.save_state() mock_actor = create_mock_actor(MyActor, "id") await mock_actor.save_state(5) -assert mockactor._state_manager._mock_state == 5 #True +assert mockactor._state_manager._mock_state['mystate'] == 5 #True ``` Mock actors are created by passing your actor class and an actor ID (a string) to the create_mock_actor function. This function returns an instance of the actor with many internal methods overridden. Instead of interacting with Dapr for tasks like saving state or managing timers, the mock actor uses in-memory state to simulate these behaviors.