interactions.py icon indicating copy to clipboard operation
interactions.py copied to clipboard

fix/test: ensure polls are being correctly processed

Open AstreaTSS opened this issue 1 year ago • 0 comments

Pull Request Type

  • [ ] Feature addition
  • [x] Bugfix
  • [ ] Documentation update
  • [ ] Code refactor
  • [x] Tests improvement
  • [ ] CI/CD pipeline enhancement
  • [ ] Other: [Replace with a description]

Description

This PR goes in and fixes (hopefully) the remaining bugs present with polls. To ensure this is actually everything, I've gone ahead and added an extensive test suite to the bot specifically for polls.

Changes

  • Correctly serialize (not deserialize, oops) questions from Polls.
  • Use answer_id instead of option for the poll events.
  • Add test suite to test out poll objects.

Related Issues

Test Scenarios

export BOT_TOKEN="BOT_TOKEN"; pytest -k "test_polls" -vv
import interactions as ipy

@ipy.listen(ipy.events.MessagePollVoteAdd)  # and MessagePollVoteRemove
async def an_event(event: ipy.events.MessagePollVoteAdd):
    print(event.user_id)
    print(event.channel_id)
    print(event.message_id)
    print(event.answer_id)
    print(event.guild_id)

Python Compatibility

  • [x] I've ensured my code works on Python 3.10.x
  • [ ] I've ensured my code works on Python 3.11.x

Checklist

  • [x] I've run the pre-commit code linter over all edited files
  • [x] I've tested my changes on supported Python versions
  • [x] I've added tests for my code, if applicable
  • [ ] I've updated / added documentation, where applicable

AstreaTSS avatar Jun 30 '24 18:06 AstreaTSS