MCPcopy
hub / github.com/reflex-dev/reflex / test_dynamic_arg_shadow

Function test_dynamic_arg_shadow

tests/units/test_app.py:1769–1788  ·  view source on GitHub ↗

Create app with dynamic route var and try to add a page with a dynamic arg that shadows a state var. Args: index_page: The index page. token: a Token. app_module_mock: Mocked app module. mocker: pytest mocker object.

(
    index_page: ComponentCallable,
    token: str,
    app_module_mock: unittest.mock.Mock,
    mocker: MockerFixture,
)

Source from the content-addressed store, hash-verified

1767
1768
1769def test_dynamic_arg_shadow(
1770 index_page: ComponentCallable,
1771 token: str,
1772 app_module_mock: unittest.mock.Mock,
1773 mocker: MockerFixture,
1774):
1775 """Create app with dynamic route var and try to add a page with a dynamic arg that shadows a state var.
1776
1777 Args:
1778 index_page: The index page.
1779 token: a Token.
1780 app_module_mock: Mocked app module.
1781 mocker: pytest mocker object.
1782 """
1783 arg_name = "counter"
1784 route = f"/test/[{arg_name}]"
1785 app = app_module_mock.app = App(_state=DynamicState)
1786 assert app._state is not None
1787 with pytest.raises(NameError):
1788 app.add_page(index_page, route=route, on_load=DynamicState.on_load)
1789
1790
1791def test_multiple_dynamic_args(

Callers

nothing calls this directly

Calls 2

AppClass · 0.90
add_pageMethod · 0.80

Tested by

no test coverage detected