-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Labels
⚙️ bot-apiaffected functionality: bot-apiaffected functionality: bot-api⚙️ testsaffected functionality: testsaffected functionality: tests⚙️ type-hintingaffected functionality: type-hintingaffected functionality: type-hinting🔌 enhancementpr description: enhancementpr description: enhancement
Description
What kind of feature are you missing? Where do you notice a shortcoming of PTB?
In test_official
we currently allow convenience input types only for send_*
methods:
python-telegram-bot/tests/test_official/arg_type_checker.py
Lines 174 to 178 in 1511237
# 2) HANDLING OTHER TYPES: | |
# Special case for send_* methods where we accept more types than the official API: | |
elif ptb_param.name in PTCE.ADDITIONAL_TYPES and obj.__name__.startswith("send"): | |
log("Checking that `%s` has an additional argument!\n", ptb_param.name) | |
mapped_type = mapped_type | PTCE.ADDITIONAL_TYPES[ptb_param.name] |
python-telegram-bot/tests/test_official/exceptions.py
Lines 39 to 48 in 1511237
ADDITIONAL_TYPES = { | |
"photo": PhotoSize, | |
"video": Video, | |
"video_note": VideoNote, | |
"audio": Audio, | |
"document": Document, | |
"animation": Animation, | |
"voice": Voice, | |
"sticker": Sticker, | |
} |
Removing the obj.__name__.startswith("send")
reveals that there are a few more parameters that could use convenience types.
Describe the solution you'd like
- Set up the "additional types" excetpions in test_official such that they can either be defined globally or per method, remove the
obj.__name__
check - add support for convenience types where possible
Describe alternatives you've considered
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
⚙️ bot-apiaffected functionality: bot-apiaffected functionality: bot-api⚙️ testsaffected functionality: testsaffected functionality: tests⚙️ type-hintingaffected functionality: type-hintingaffected functionality: type-hinting🔌 enhancementpr description: enhancementpr description: enhancement