test_bare.py 578 B

123456789101112131415161718192021222324
  1. import pytest
  2. from reflex.components.base.bare import Bare
  3. @pytest.mark.parametrize(
  4. "contents,expected",
  5. [
  6. ("hello", "hello"),
  7. ("{}", "{}"),
  8. (None, ""),
  9. ("${default_state.name}", "${default_state.name}"),
  10. ("{state.name}", "{state.name}"),
  11. ],
  12. )
  13. def test_fstrings(contents, expected):
  14. """Test that fstrings are rendered correctly.
  15. Args:
  16. contents: The contents of the component.
  17. expected: The expected output.
  18. """
  19. comp = Bare.create(contents).render()
  20. assert comp["contents"] == expected