-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
When testing (for example) if an embed matches what it's expected the error it's nested and doesn't give clear information about what went wrong.
For example I have this test:
@pytest.mark.asyncio
async def test_roll_ok(bot):
roll = f'{bot.command_prefix}roll 20'
expected_embed = discord.Embed(
title=f'Roll *{roll}*',
description='You rolled **20**.',
)
expected_embed.set_footer(text='20: [20]')
await dpytest.message(content=roll)
assert dpytest.verify().message().embed(expected_embed), 'Wrong embed sent'
roll 20will return 20 since is not rolling a dice making a sum
The returned error is:
E AssertionError: Wrong embed sent
E assert <discord.ext.test.verify.VerifyMessage object at 0x7f39d58af7f0>
E + where <discord.ext.test.verify.VerifyMessage object at 0x7f39d58af7f0> = <bound method VerifyMessage.embed of <discord.ext.test.verify.VerifyMessage object at 0x7f39d58af7f0>>(<discord.embeds.Embed object at 0x7f39d9e70310>)
E + where <bound method VerifyMessage.embed of <discord.ext.test.verify.VerifyMessage object at 0x7f39d58af7f0>> = <discord.ext.test.verify.VerifyMessage object at 0x7f39d58af7f0>.embed
E + where <discord.ext.test.verify.VerifyMessage object at 0x7f39d58af7f0> = <bound method Verify.message of <discord.ext.test.verify.Verify object at 0x7f39d58af130>>()
E + where <bound method Verify.message of <discord.ext.test.verify.Verify object at 0x7f39d58af130>> = <discord.ext.test.verify.Verify object at 0x7f39d58af130>.message
E + where <discord.ext.test.verify.Verify object at 0x7f39d58af130> = <function verify at 0x7f39d6129670>()
E + where <function verify at 0x7f39d6129670> = dpytest.verifyI don't have a text of what didn't match or what did happen. How can this be tested correctly?
steezeburger and Honkou
Metadata
Metadata
Assignees
Labels
No labels