-
wondering how we can write tests to make sure our codebase is 100% typed. @ht-thomas could you provide some guidance on this? We want to make sure we are as comprehensive as possible in our testing. Below is my attempt import inspect
import types
import unittest
from typing import Any, Dict, Optional, Tuple, Type, Union
from autobot.telegram.games import Game
from autobot.telegram.objects import *
class TestTypes(unittest.TestCase):
def test_init_for_game(self):
self.assertTrue(inspect.isfunction(Game.__init__))
self.assertEqual(Game.__init__.__annotations__, {
'self': Game,
'game_title': str,
'game_description': str,
'game_photo': list[PhotoSize],
'game_text': Optional[str],
'game_text_entities': Optional[list[MessageEntity]],
'game_animation': Optional[Animation],
})
if __name__ == '__main__':
unittest.main() |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@kallyas going that route would be too hectic and inefficient as we might not know if the typing we've applied on the methods and variables is even correct. I plan to use mypy for all things that require typing identification and verification. We shall just create a workflow that calls mypy. And if need be, we can configure it ourselves for other things |
Beta Was this translation helpful? Give feedback.
@kallyas going that route would be too hectic and inefficient as we might not know if the typing we've applied on the methods and variables is even correct. I plan to use mypy for all things that require typing identification and verification. We shall just create a workflow that calls mypy. And if need be, we can configure it ourselves for other things