Merge branch 'dev-2.x'

This commit is contained in:
Alex Root Junior 2020-01-05 20:28:15 +02:00
commit e91d5466a7
4 changed files with 8 additions and 4 deletions

View file

@ -180,7 +180,7 @@ class CommandStart(Command):
return {'deep_link': match}
return False
return False
return check
class CommandHelp(Command):

View file

@ -75,7 +75,7 @@ class CallbackData:
raise TypeError('Too many arguments were passed!')
callback_data = self.sep.join(data)
if len(callback_data) > 64:
if len(callback_data.encode()) > 64:
raise ValueError('Resulted callback data is too long!')
return callback_data

View file

@ -102,14 +102,18 @@ def renamed_argument(old_name: str, new_name: str, until_version: str, stackleve
is_coroutine = asyncio.iscoroutinefunction(func)
def _handling(kwargs):
"""
Returns updated version of kwargs.
"""
routine_type = 'coroutine' if is_coroutine else 'function'
if old_name in kwargs:
warn_deprecated(f"In {routine_type} '{func.__name__}' argument '{old_name}' "
f"is renamed to '{new_name}' "
f"and will be removed in aiogram {until_version}",
stacklevel=stacklevel)
kwargs = kwargs.copy()
kwargs.update({new_name: kwargs.pop(old_name)})
return kwargs
return kwargs
if is_coroutine:
@functools.wraps(func)

View file

@ -276,7 +276,7 @@ class TestCommandStart:
test_filter = CommandStart() # empty filter
message = Message(text=self.START)
result = await test_filter.check(message)
assert result == {'deep_link': None}
assert result
async def test_start_command_payload_is_matched(self):
test_filter = CommandStart(deep_link=self.GOOD)