mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Fix type name in error message for router type validation
This commit is contained in:
parent
395d45c960
commit
03f51b7bca
2 changed files with 4 additions and 2 deletions
|
|
@ -262,7 +262,7 @@ class Router:
|
|||
:return:
|
||||
"""
|
||||
if not isinstance(router, Router):
|
||||
msg = f"router should be instance of Router not {type(router).__class__.__name__}"
|
||||
msg = f"router should be instance of Router not {type(router).__name__!r}"
|
||||
raise ValueError(msg)
|
||||
router.parent_router = self
|
||||
return router
|
||||
|
|
|
|||
|
|
@ -50,7 +50,9 @@ class TestRouter:
|
|||
|
||||
def test_include_router_by_string_bad_type(self):
|
||||
router = Router()
|
||||
with pytest.raises(ValueError, match=r"router should be instance of Router"):
|
||||
with pytest.raises(
|
||||
ValueError, match=r"router should be instance of Router not 'TestRouter'"
|
||||
):
|
||||
router.include_router(self)
|
||||
|
||||
def test_set_parent_router_bad_type(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue