Closed azhitian closed 5 months ago
Yeah, I'd been messing a bit with it to see if I could get past the default objects being parameters instead of following the type hint. It would be less frustrating if discord.py supported adding help to commands with anything other than default parameter objects. Concluded it wasn't worth it to try and restructure everything, as you concluded it's something that the library handles behind the scenes and for doing mock-based testing we need to handle manually. Although I'll probably need to rewrite the help method anyways.
You can get around most of the issues by using integration tests instead of direct calls, at the cost of granularity.
Attention: 9 lines
in your changes are missing coverage. Please review.
Comparison is base (
1f078db
) 90.72% compared to head (6533648
) 87.86%.
Files | Patch % | Lines |
---|---|---|
src/word_debt_bot/game/core.py | 14.28% | 6 Missing :warning: |
src/word_debt_bot/cogs/game_commands.py | 66.66% | 3 Missing :warning: |
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Removed dead code
Closes #36.
I'm not familiar with BearType, but it complained at me
E beartype.roar.BeartypeCallHintParamViolation: Method word_debt_bot.game.core.WordDebtGame.get_player_by_name() parameter display_name=<Parameter "empty=None"> violates type hint <class 'str'> under non-default configuration BeartypeConf(claw_is_pep526=True, is_color=None, is_debug=False, is_pep484_tower=False, strategy=<BeartypeStrategy.O1: 2>, warning_cls_on_decorator_exception=<class 'beartype.roar._roarwarn.BeartypeClawDecorWarning'>), as <class "discord.ext.commands.parameters.Parameter"> <Parameter "empty=None"> not instance of str.
so I modified
await game_commands_cog.info(game_commands_cog, ctx)
to
await game_commands_cog.info(game_commands_cog, ctx, None)
I'm assuming this is a limitation of using mocks, and in real usage Discord would pass a None and not a Parameter object. Testing the actual bot live on a Discord server it seems to work both with and without the name. Not sure if you think it's worth modifying how command tests are structured over this.