reflex/tests/components/base/test_bare.py
2024-08-13 13:06:58 -07:00

25 lines
586 B
Python

import pytest
from reflex.components.base.bare import Bare
@pytest.mark.parametrize(
"contents,expected",
[
("hello", '{"hello"}'),
("{}", '{"{}"}'),
(None, ""),
("${default_state.name}", "${default_state.name}"),
("{state.name}", "{state.name}"),
],
)
def test_fstrings(contents, expected):
"""Test that fstrings are rendered correctly.
Args:
contents: The contents of the component.
expected: The expected output.
"""
comp = Bare.create(contents).render()
assert comp["contents"] == expected