Skip to content

Enhancement request: format the assertion error on assert_called_with #276

@Polandia94

Description

@Polandia94

On assert_called_with the assertionError have a very verbose error message, becuase it raise all the actual and expected request. For complex request, is difficult to know where is the difference.

As this happen only when there is a difference, i think there will not be a performance issue on replace

        if not expected == actual:
            expected_string = self._format_call_signature(
                expected,
            )
            actual_string = self._format_call_signature(
                actual
            )
            raise AssertionError(
                '%s != %s' % (expected_string, actual_string)
            )

in assert_called_with to a comparision of expected.args against actual.args and expected.kwargs against actual.kwargs with some formatting.

If you want i can create a PR with the change.

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