mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Update tests for all methods
This commit is contained in:
parent
33c661d732
commit
23abe35212
27 changed files with 428 additions and 189 deletions
|
|
@ -4,7 +4,7 @@ import abc
|
|||
import secrets
|
||||
from typing import TYPE_CHECKING, Any, Dict, Generic, Optional, Type, TypeVar
|
||||
|
||||
from pydantic import BaseConfig, BaseModel
|
||||
from pydantic import BaseConfig, BaseModel, Extra
|
||||
from pydantic.generics import GenericModel
|
||||
|
||||
from ..types import InputFile, ResponseParameters
|
||||
|
|
@ -35,7 +35,7 @@ class Response(ResponseParameters, GenericModel, Generic[T]):
|
|||
class TelegramMethod(abc.ABC, BaseModel, Generic[T]):
|
||||
class Config(BaseConfig):
|
||||
# use_enum_values = True
|
||||
# extra = Extra.allow
|
||||
extra = Extra.allow
|
||||
allow_population_by_field_name = True
|
||||
arbitrary_types_allowed = True
|
||||
orm_mode = True
|
||||
|
|
|
|||
|
|
@ -33,9 +33,8 @@ class SendMediaGroup(TelegramMethod[List[Message]]):
|
|||
|
||||
return Request(method="sendMediaGroup", data=data, files=files)
|
||||
|
||||
def prepare_input_media(self, data: Dict[str, Any], files: Dict[str, InputFile]) -> None:
|
||||
if not self.media:
|
||||
return
|
||||
@staticmethod
|
||||
def prepare_input_media(data: Dict[str, Any], files: Dict[str, InputFile]) -> None:
|
||||
for input_media in data.get("media", []): # type: Dict[str, Union[str, InputFile]]
|
||||
if (
|
||||
"media" in input_media
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue