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,
)
| 1767 | |
| 1768 | |
| 1769 | def 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 | |
| 1791 | def test_multiple_dynamic_args( |