Skip to content

Make telegram.Bot comparable #2320

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

Merged
merged 5 commits into from
Jan 17, 2021
Merged

Make telegram.Bot comparable #2320

merged 5 commits into from
Jan 17, 2021

Conversation

starry-shivam
Copy link
Member

Closes #2319

Signed-off-by: starry69 <starry369126@outlook.com>
Signed-off-by: starry69 <starry369126@outlook.com>
Copy link
Member

@Bibo-Joshi Bibo-Joshi left a comment

Choose a reason for hiding this comment

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

Mh, actually you're right about self.get_me() already setting self._bot, but imo it's still more readible to assign the return value anyway.

Some more notes:

  • Please document that bot is now comparable (See e.g. here) probably just do it als
    .. versionadded:: 13.2
       Objects of this class
  • After a closer look the tests fail b/c some tests want to monkeypatch bot.bot, which is no longer possible. Ig just making them patch bot._bot instead should be fine
  • Some other tests fail, b/c Bot is no longer hashable. Bot.__hash__ should return hash(self.bot), as that's what we're comparing with. see here
  • For what the equality tests should look like please see here

Signed-off-by: starry69 <starry369126@outlook.com>
Copy link
Member

@Bibo-Joshi Bibo-Joshi left a comment

Choose a reason for hiding this comment

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

Thanks for the updates! Just two comments left :)

@Bibo-Joshi Bibo-Joshi merged commit b43a599 into master Jan 17, 2021
@Bibo-Joshi Bibo-Joshi deleted the bot-comparison branch January 17, 2021 08:23
@github-actions github-actions bot locked and limited conversation to collaborators Jan 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Make tg.Bot comparable
2 participants