fix tests

This commit is contained in:
Lendemor 2024-10-04 21:37:48 +02:00
parent 54ab0e22fe
commit 2425dd8f36
2 changed files with 3 additions and 2 deletions

View File

@ -6,7 +6,7 @@ import pytest
from reflex.components.base.fragment import Fragment from reflex.components.base.fragment import Fragment
from reflex.components.core.cond import Cond, cond from reflex.components.core.cond import Cond, cond
from reflex.components.radix.themes.typography.text import Text from reflex.components.radix.themes.typography.text import Text
from reflex.state import BaseState, State from reflex.state import BaseState
from reflex.utils.format import format_state_name from reflex.utils.format import format_state_name
from reflex.vars.base import LiteralVar, Var, computed_var from reflex.vars.base import LiteralVar, Var, computed_var
@ -124,7 +124,7 @@ def test_cond_no_else():
def test_cond_computed_var(): def test_cond_computed_var():
"""Test if cond works with computed vars.""" """Test if cond works with computed vars."""
class CondStateComputed(State): class CondStateComputed(BaseState):
@computed_var @computed_var
def computed_int(self) -> int: def computed_int(self) -> int:
return 0 return 0

View File

@ -766,6 +766,7 @@ async def test_upload_file(tmp_path, state, delta, token: str, mocker):
state._tmp_path = tmp_path state._tmp_path = tmp_path
# The App state must be the "root" of the state tree # The App state must be the "root" of the state tree
app = App() app = App()
app._enable_state()
app.event_namespace.emit = AsyncMock() # type: ignore app.event_namespace.emit = AsyncMock() # type: ignore
current_state = await app.state_manager.get_state(_substate_key(token, state)) current_state = await app.state_manager.get_state(_substate_key(token, state))
data = b"This is binary data" data = b"This is binary data"