Improve typing and reformat code

This commit is contained in:
Alex Root Junior 2019-11-28 23:21:19 +02:00
parent c674b5547b
commit 562e339262
4 changed files with 20 additions and 17 deletions

View file

@ -2,23 +2,23 @@ from unittest.mock import patch
import pytest
from aiogram.utils.token import TokenValidationError, validate_token, extract_bot_id
from aiogram.utils.token import TokenValidationError, extract_bot_id, validate_token
BOT_ID = 123456789
VALID_TOKEN = '123456789:AABBCCDDEEFFaabbccddeeff-1234567890'
VALID_TOKEN = "123456789:AABBCCDDEEFFaabbccddeeff-1234567890"
INVALID_TOKENS = [
'123456789:AABBCCDDEEFFaabbccddeeff 123456789', # space is exists
'ABC:AABBCCDDEEFFaabbccddeeff123456789', # left part is not digit
':AABBCCDDEEFFaabbccddeeff123456789', # there is no left part
'123456789:', # there is no right part
'ABC AABBCCDDEEFFaabbccddeeff123456789', # there is no ':' separator
"123456789:AABBCCDDEEFFaabbccddeeff 123456789", # space is exists
"ABC:AABBCCDDEEFFaabbccddeeff123456789", # left part is not digit
":AABBCCDDEEFFaabbccddeeff123456789", # there is no left part
"123456789:", # there is no right part
"ABC AABBCCDDEEFFaabbccddeeff123456789", # there is no ':' separator
None, # is None
12345678, # is digit
(42, 'TEST'), # is tuple
(42, "TEST"), # is tuple
]
@pytest.fixture(params=INVALID_TOKENS, name='invalid_token')
@pytest.fixture(params=INVALID_TOKENS, name="invalid_token")
def invalid_token_fixture(request):
return request.param