idk what's this (a lot of time ago)

This commit is contained in:
zemf4you 2024-08-22 09:59:38 +07:00
parent 7bd8f64630
commit fa1b891386
187 changed files with 914 additions and 915 deletions

View file

@ -1,11 +1,9 @@
from typing import Any, Dict
from unittest.mock import sentinel
import pytest
from aiogram.client.default import Default
from aiogram.methods import GetMe, SendMessage, TelegramMethod
from aiogram.types import LinkPreviewOptions, TelegramObject, User
from aiogram.methods import GetMe, TelegramMethod
from aiogram.types import TelegramObject, User
from tests.mocked_bot import MockedBot
@ -29,22 +27,24 @@ class TestTelegramMethodRemoveUnset:
class TestTelegramMethodModelDumpJson:
@pytest.mark.parametrize(
"obj",
[
SendMessage(
chat_id=1,
text="test",
),
LinkPreviewOptions(),
],
)
def test_model_dump_json(self, obj):
def has_defaults(dump: Dict[str, Any]) -> bool:
return any(isinstance(value, Default) for value in dump.values())
assert has_defaults(obj.model_dump())
assert not has_defaults(obj.model_dump(mode="json"))
...
# TODO
# @pytest.mark.parametrize(
# "obj",
# [
# SendMessage(
# chat_id=1,
# text="test",
# ),
# LinkPreviewOptions(),
# ],
# )
# def test_model_dump_json(self, obj):
# def has_defaults(dump: Dict[str, Any]) -> bool:
# return any(isinstance(value, Default) for value in dump.values())
#
# assert has_defaults(obj.model_dump())
# assert not has_defaults(obj.model_dump(mode="json"))
class TestTelegramMethodCall: