mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-11 01:54:53 +00:00
tests(deprecated-observer): clean code
remove empty possible func. add new condition for version major
This commit is contained in:
parent
9bd981726f
commit
6cbf9cdde6
1 changed files with 3 additions and 6 deletions
|
|
@ -23,18 +23,15 @@ OBSERVERS = {
|
|||
def test_deprecated_handlers_name():
|
||||
from aiogram import __version__
|
||||
|
||||
minor_partial = int(__version__.split(".")[1])
|
||||
major, minor = map(int, __version__.split(".")[:-1])
|
||||
|
||||
if minor_partial >= 2:
|
||||
if minor >= 2 and major >= 3: # version >=3.2.*
|
||||
do_assert = pytest.raises(AttributeError)
|
||||
else:
|
||||
else: # for versions <=3.2.* (we don't care if major is lesser than `3`)
|
||||
do_assert = pytest.warns(DeprecationWarning)
|
||||
|
||||
router = Router()
|
||||
|
||||
async def _(__):
|
||||
...
|
||||
|
||||
with do_assert:
|
||||
for decor in OBSERVERS:
|
||||
getattr(router, decor + "_handler")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue