reflex/tests/components/base/test_bare.py
Thomas Brandého 0af4770180
generate pyi files when building/publishing 3rd party component (#2945)
* build pyi files when building/publishing 3rd party

* fix typo in workflow

* add future annotation

* add tests to pass coverage check

* add more unit tests

* omit pyi_generator from test coverage

* change black from dev deps to direct deps

* remake all pyi

* format pyi if black is present, return as if otherwise

* fix requested changes

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-03-29 09:54:21 -07:00

25 lines
578 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