Skip to content

Commit 77cf085

Browse files
committed
fix: Pyright should be much happier now, but why?
1 parent 3ddee1c commit 77cf085

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

tests/units/test_state.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4475,13 +4475,13 @@ async def test_rebind_mutable_proxy(mock_app: rx.App, token: str) -> None:
44754475
class NormalState(rx.State):
44764476
"""This state should be serialized."""
44774477

4478-
value: rx.Field[int] = rx.field(42)
4478+
value: int = 42
44794479

44804480

44814481
class SkippedState(NormalState):
44824482
"""This state should not be serialized."""
44834483

4484-
skipped_value: rx.Field[int] = rx.field(43)
4484+
skipped_value: int = 43
44854485

44864486
@property
44874487
def _skip_serialization(self) -> bool:
@@ -4491,35 +4491,35 @@ def _skip_serialization(self) -> bool:
44914491
class SkippedSubState(SkippedState):
44924492
"""This state should not be serialized."""
44934493

4494-
substate_value: rx.Field[int] = rx.field(44)
4494+
substate_value: int = 44
44954495

44964496

44974497
def test_default_skip_serialization_is_false():
4498-
state = NormalState(_reflex_internal_init=True)
4498+
state = NormalState()
44994499
assert state._skip_serialization is False
45004500

45014501

45024502
def test_subclass_override_is_respected():
45034503
"""Subclass override must actually take effect."""
4504-
assert SkippedState(_reflex_internal_init=True)._skip_serialization is True
4505-
assert NormalState(_reflex_internal_init=True)._skip_serialization is False
4504+
assert SkippedState()._skip_serialization is True
4505+
assert NormalState()._skip_serialization is False
45064506

45074507

45084508
def test_dict_contains_value_by_default():
4509-
state = NormalState(_reflex_internal_init=True)
4509+
state = NormalState()
45104510
state_dict = str(state.dict())
45114511
assert "42" in state_dict
45124512
assert "43" not in state_dict
45134513
assert "44" not in state_dict
45144514

45154515

45164516
def test_dict_empty_when_skip_serialization():
4517-
state = SkippedState(_reflex_internal_init=True)
4517+
state = SkippedState()
45184518
assert state.dict() == {}
45194519

45204520

45214521
def test_get_delta_contains_value_after_change():
4522-
state = NormalState(_reflex_internal_init=True)
4522+
state = NormalState()
45234523
state.value = 99
45244524
state_delta = str(state.get_delta())
45254525
assert "99" in state_delta
@@ -4528,22 +4528,22 @@ def test_get_delta_contains_value_after_change():
45284528

45294529

45304530
def test_get_delta_empty_when_skip_serialization():
4531-
state = SkippedState(_reflex_internal_init=True)
4531+
state = SkippedState()
45324532
state.skipped_value = 99
45334533
assert state.get_delta() == {}
45344534

45354535

45364536
def test_substate_of_skipped_parent_is_also_skipped():
45374537
"""Substates of a skipped parent are also skipped, even without overriding _skip_serialization."""
4538-
state = SkippedSubState(_reflex_internal_init=True)
4538+
state = SkippedSubState()
45394539
state.substate_value = 99
45404540
assert state.get_delta() == {}
45414541
assert state.dict() == {}
45424542

45434543

45444544
def test_normal_state_unaffected_by_skipped_substate():
45454545
"""NormalState delta must not be affected by its skipped substate."""
4546-
state = NormalState(_reflex_internal_init=True)
4546+
state = NormalState()
45474547
state.value = 99
45484548
delta = str(state.get_delta())
45494549
assert "99" in delta

0 commit comments

Comments
 (0)