New tests, step 1 - #2617
Conversation
Full de_json test coverage for all JsonDeserializable classes.
|
@coder2020official I worked on adoption of AI and agent(s) and decided to practice on pyTelegramBotAPI 😂. I'm not absolutely sure we need such tests, but they looks better then previous ones. Please, take a look. If you think at least "why not" - I'll merge them and see what else usefull can be done ) |
| assert msg.document.file_name == 'Text File' | ||
| assert msg.content_type == 'document' | ||
| def test_json_businessbotrights(): | ||
| result = types.BusinessBotRights.de_json({}) |
There was a problem hiding this comment.
what's the point of an empty json
There was a problem hiding this comment.
Das bug ) I missed this while check result...
|
|
||
|
|
||
|
|
||
| sample_string_3 = r'{"update_id":934522172,"message":{"message_id":1374530,"from":{"id":927266710,"is_bot":false,"first_name":">_run","username":"coder2020","language_code":"en","is_premium":true},"chat":{"id":927266710,"first_name":">_run","username":"coder2020","type":"private"},"date":1682179968,"text":"This is a bold text with a nested italic and bold text.","entities":[{"offset":10,"length":4,"type":"bold"},{"offset":27,"length":7,"type":"italic"},{"offset":34,"length":15,"type":"bold"},{"offset":34,"length":15,"type":"italic"}]}}' |
There was a problem hiding this comment.
I liked these kind of tests for html_text
There was a problem hiding this comment.
Reasonable, will take care on that.
There was a problem hiding this comment.
Added html_text tests.
|
Our tests sucked anyways so I don't know what to say |
I had plans to work on other tests. I did not check them yet if they are functional and/or may be functional in future ) |
|
|
||
| def test_json_generalforumtopichidden(): | ||
| result = types.GeneralForumTopicHidden.de_json({}) | ||
| assert isinstance(result, types.GeneralForumTopicHidden) or result is None |
There was a problem hiding this comment.
why the or result is None
|
otherwise on a quick glance looks fine |
|
I'm done here. Agents are interesting. I'll hope what I teached my agent will help us improve the process. I'll go further with lot of other checks for types, functions etc. Will keep in touch ) |
|
I'll merge to continue. If need more fixes - I'll do more PRs. |
Full de_json test coverage for all JsonDeserializable classes.