Skip to content

Conversation

@MOpryshko
Copy link

PR checklist

  • I've written good commit message for all commits
  • I've split changes into separate commits where it's appropriate
  • I've added the description of function to documentation
  • I've updated project version in pyproject.toml
  • I'll make a release when PR is merged
  • I'll bump pybotx in bot-template

@vladimirgubarik
Copy link
Contributor

Линтер не проходит тесты

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]
Copy link
Contributor

@vladimirgubarik vladimirgubarik Sep 22, 2025

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]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это рудимент от предыдущей реализации валидатора

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants