Skip to content

"assert_called_with" function shall not consider elements order in list. #275

@ranjithvuppala

Description

@ranjithvuppala

when using aiohttp.Request with json parameter, we can pass python dictionary.

For e.g

sample_post_dict = {"name": "dummy", "values": ["test_value1", "test_value2"]}
async with session.post(url, json=sample_post_dict) as resp:
    data = await resp.json()

In the above example, the order of elements for key "values" depends on json serializer.

When using aioresponses and catch this request, using "assert_called_with" returns True or False arbitrarily based on the order passed to "json" parameter through kwargs.

"assert_called_with" relies on python list comparison which will return False if order of elements is different. But from requests perspective the order of elements is not important 99% of the time.

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