Skip to content

Unclear error message #70

@LeCuay

Description

@LeCuay

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 20 will 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.verify

I don't have a text of what didn't match or what did happen. How can this be tested correctly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions