Skip to content

Shouldn't call callable attributes with .extracting #124

@santunioni

Description

@santunioni

I am having some issue asserting attributes from FastAPI Depends class. The Depends have an attribute for saving your dependency:

class Depends:
    def __init__(dependency):
        self.dependency = dependency

The dependency attribute must be a callable (anything that implements __call__).
I am trying to replace this function in my test for something like:

assert_that(dependencies).extracting('dependency').is_equal_to([dependency_limiter])

However, as the dependency attribute is a callable, because the zero-args-method-call feature, the extracting method is calling dependency attribute instead of just returning it.

I think the behavior I described above would be better. What do you think?

I am submitting a PR in case you agree with me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions