Skip to content

New tests, step 1 - #2617

Merged
Badiboy merged 6 commits into
eternnoir:masterfrom
Badiboy:master
Aug 16, 2026
Merged

New tests, step 1#2617
Badiboy merged 6 commits into
eternnoir:masterfrom
Badiboy:master

Conversation

@Badiboy

@Badiboy Badiboy commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

Full de_json test coverage for all JsonDeserializable classes.

Full de_json test coverage for all JsonDeserializable classes.
@Badiboy Badiboy changed the title New test, step 1 New tests, step 1 Aug 15, 2026
@Badiboy

Badiboy commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator Author

@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 )

Comment thread tests/test_types.py Outdated
assert msg.document.file_name == 'Text File'
assert msg.content_type == 'document'
def test_json_businessbotrights():
result = types.BusinessBotRights.de_json({})

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

what's the point of an empty json

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Das bug ) I missed this while check result...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.

Comment thread tests/test_types.py



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"}]}}'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I liked these kind of tests for html_text

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reasonable, will take care on that.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added html_text tests.

@coder2020official

Copy link
Copy Markdown
Collaborator

Our tests sucked anyways so I don't know what to say

@Badiboy

Badiboy commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator Author

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 )

Comment thread tests/test_types.py Outdated

def test_json_generalforumtopichidden():
result = types.GeneralForumTopicHidden.de_json({})
assert isinstance(result, types.GeneralForumTopicHidden) or result is None

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why the or result is None

@Badiboy Badiboy Aug 16, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

@coder2020official

Copy link
Copy Markdown
Collaborator

otherwise on a quick glance looks fine

@Badiboy

Badiboy commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator Author

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 )

@Badiboy

Badiboy commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator Author

I'll merge to continue. If need more fixes - I'll do more PRs.

@Badiboy
Badiboy merged commit dce405b into eternnoir:master Aug 16, 2026
6 checks passed
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