mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
fix: change order of Union types for media properties
The order of Union types for media properties in various files was reversed to `Union[str, InputFile]` for consistency. The changes were made in the following files: - aiogram/types/input_media_video.py - aiogram/types/input_media_audio.py - aiogram/types/input_media_document.py - aiogram/types/input_media_animation.py - aiogram/types/input_media_photo.py - aiogram/utils/media_group.py fix: update type check in base.py for TelegramObject (dev-3) Replaced BotContextController with TelegramObject in the type check to ensure proper handling of non-standard objects. test: add TODO comments in test files (dev-3) Added TODO comments to highlight parts of the code that need future improvements in the following test files: - tests/test_api/test_types/test_input_file.py - tests/test_api/test_client/test_session/test
This commit is contained in:
parent
1ea41076cd
commit
534221a30a
12 changed files with 33 additions and 32 deletions
|
|
@ -122,7 +122,7 @@ class TestBaseSession:
|
|||
),
|
||||
"1494994302",
|
||||
],
|
||||
[LinkPreviewOptions(is_disabled=True, url=None), '{"is_disabled":true}'],
|
||||
[LinkPreviewOptions(is_disabled=True), '{"is_disabled":true}'],
|
||||
[Default("parse_mode"), "HTML"],
|
||||
[Default("protect_content"), "true"],
|
||||
[Default("link_preview_is_disabled"), "true"],
|
||||
|
|
|
|||
|
|
@ -20,15 +20,15 @@ class TestTelegramMethodRemoveUnset:
|
|||
)
|
||||
@pytest.mark.parametrize("obj", [TelegramMethod, TelegramObject])
|
||||
def test_remove_unset(self, values, names, obj):
|
||||
validated = obj.remove_unset(values)
|
||||
validated = obj.remove_unset.wrapped(values)
|
||||
assert set(validated.keys()) == names
|
||||
|
||||
@pytest.mark.parametrize("obj", [TelegramMethod, TelegramObject])
|
||||
def test_remove_unset_non_dict(self, obj):
|
||||
assert obj.remove_unset("") == ""
|
||||
assert obj.remove_unset.wrapped("") == ""
|
||||
|
||||
|
||||
class TestTelegramMethodJsonSerialize:
|
||||
class TestTelegramMethodModelDumpJson:
|
||||
@pytest.mark.parametrize(
|
||||
"obj",
|
||||
[
|
||||
|
|
@ -39,7 +39,7 @@ class TestTelegramMethodJsonSerialize:
|
|||
LinkPreviewOptions(),
|
||||
],
|
||||
)
|
||||
def test_json_serialize(self, obj):
|
||||
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())
|
||||
|
||||
|
|
|
|||
|
|
@ -99,3 +99,5 @@ class TestInputFile:
|
|||
assert chunk_size == 1
|
||||
size += chunk_size
|
||||
assert size == 10
|
||||
|
||||
# TODO: used_valid_bot
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue