-
Notifications
You must be signed in to change notification settings - Fork 15
fix: Fixed convert chat type in method create_chat #522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release-candidate
Are you sure you want to change the base?
Conversation
|
Линтер не проходит тесты |
| values = {"chat_type": ChatTypes.GROUP_CHAT} | ||
| result = BotXAPICreateChatRequestPayload._convert_chat_type(values) # type: ignore[operator] | ||
| assert result["chat_type"] == APIChatTypes.GROUP_CHAT | ||
| result = BotXAPICreateChatRequestPayload._convert_chat_type(ChatTypes.GROUP_CHAT) # type: ignore[operator] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не совсем понимаю, зачем тестировать проткетед метод модели.
Это создает хрупкие тесты. Если ты станешь валидировать как-то по другому(например в рут валидаторе), то придется переписывать и этот тест.
К тому же, если кто-то вдруг нечаянно уберет декоратор с этого метода модели - тест все равно будет проходить .
Лучше протестировать всю работу создания модели, так будет надежнее.
| assert result == APIChatTypes.CHAT | ||
|
|
||
| # Test with missing chat_type key | ||
| values = {"name": "test"} # type: ignore[dict-item] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это рудимент от предыдущей реализации валидатора
|
PR checklist
pyproject.tomlpybotxinbot-template