test_bare.py 558 B

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