__init__.py 718 B

12345678910111213141516171819202122232425262728293031
  1. """Common rx.State subclasses for use in tests."""
  2. import reflex as rx
  3. from .mutation import DictMutationTestState, ListMutationTestState, MutableTestState
  4. from .upload import (
  5. ChildFileUploadState,
  6. FileStateBase1,
  7. FileUploadState,
  8. GrandChildFileUploadState,
  9. SubUploadState,
  10. UploadState,
  11. )
  12. class GenState(rx.State):
  13. """A state with event handlers that generate multiple updates."""
  14. value: int
  15. def go(self, c: int):
  16. """Increment the value c times and update each time.
  17. Args:
  18. c: The number of times to increment.
  19. Yields:
  20. After each increment.
  21. """
  22. for _ in range(c):
  23. self.value += 1
  24. yield