rename base_state to state

This commit is contained in:
Benedikt Bartscher 2024-12-14 01:28:44 +01:00
parent c9db0ceb14
commit 19d6e69913
No known key found for this signature in database

View File

@ -91,7 +91,7 @@ def grand_child_state_token(token: str) -> str:
@pytest.fixture @pytest.fixture
def base_state_token(token: str) -> str: def state_token(token: str) -> str:
"""Fixture for the base state token. """Fixture for the base state token.
Args: Args:
@ -148,7 +148,7 @@ def grand_child_state_big(grand_child_state: GrandChildState) -> GrandChildState
return grand_child_state return grand_child_state
def test_set_base_state( def test_set_state(
benchmark: BenchmarkFixture, benchmark: BenchmarkFixture,
state_manager: StateManagerRedis, state_manager: StateManagerRedis,
event_loop: asyncio.AbstractEventLoop, event_loop: asyncio.AbstractEventLoop,
@ -170,11 +170,11 @@ def test_set_base_state(
benchmark(func) benchmark(func)
def test_get_base_state( def test_get_state(
benchmark: BenchmarkFixture, benchmark: BenchmarkFixture,
state_manager: StateManagerRedis, state_manager: StateManagerRedis,
event_loop: asyncio.AbstractEventLoop, event_loop: asyncio.AbstractEventLoop,
base_state_token: str, state_token: str,
) -> None: ) -> None:
"""Benchmark getting state with minimal data. """Benchmark getting state with minimal data.
@ -182,17 +182,15 @@ def test_get_base_state(
benchmark: The benchmark fixture. benchmark: The benchmark fixture.
state_manager: The state manager fixture. state_manager: The state manager fixture.
event_loop: The event loop fixture. event_loop: The event loop fixture.
base_state_token: The base state token fixture. state_token: The base state token fixture.
""" """
state = State() state = State()
event_loop.run_until_complete( event_loop.run_until_complete(
state_manager.set_state(token=base_state_token, state=state) state_manager.set_state(token=state_token, state=state)
) )
def func(): def func():
_ = event_loop.run_until_complete( _ = event_loop.run_until_complete(state_manager.get_state(token=state_token))
state_manager.get_state(token=base_state_token)
)
benchmark(func) benchmark(func)