Update documentation and code snippets

This commit is contained in:
2025-12-08 19:29:54 +03:00
parent 75b1efb259
commit 183f069766
6 changed files with 179 additions and 4 deletions
+84
View File
@@ -221,6 +221,90 @@ def test_overlapping_aliases_raises_exception() -> None:
pass
def test_app_detects_trigger_collision_between_routers() -> None:
from argenta.router.exceptions import RepeatedTriggerNameException
app = App()
router1 = Router()
router2 = Router()
@router1.command('hello')
def handler1(_res: Response) -> None:
pass
@router2.command('hello')
def handler2(_res: Response) -> None:
pass
app.include_router(router1)
app.include_router(router2)
with pytest.raises(RepeatedTriggerNameException):
app._pre_cycle_setup()
def test_app_detects_alias_collision_between_routers() -> None:
app = App()
router1 = Router()
router2 = Router()
@router1.command(Command('hello', aliases={'hi'}))
def handler1(_res: Response) -> None:
pass
@router2.command(Command('world', aliases={'hi'}))
def handler2(_res: Response) -> None:
pass
app.include_router(router1)
app.include_router(router2)
with pytest.raises(RepeatedAliasNameException):
app._pre_cycle_setup()
def test_app_detects_trigger_alias_collision_between_routers() -> None:
app = App()
router1 = Router()
router2 = Router()
@router1.command('hello')
def handler1(_res: Response) -> None:
pass
@router2.command(Command('world', aliases={'hello'}))
def handler2(_res: Response) -> None:
pass
app.include_router(router1)
app.include_router(router2)
with pytest.raises(RepeatedAliasNameException):
app._pre_cycle_setup()
def test_app_detects_collision_case_insensitive() -> None:
from argenta.router.exceptions import RepeatedTriggerNameException
app = App()
router1 = Router()
router2 = Router()
@router1.command('Hello')
def handler1(_res: Response) -> None:
pass
@router2.command('hELLo')
def handler2(_res: Response) -> None:
pass
app.include_router(router1)
app.include_router(router2)
with pytest.raises(RepeatedTriggerNameException):
app._pre_cycle_setup()
# ============================================================================
# Tests for startup messages
# ============================================================================