Skip to content

Allowances/expectations on properties with setter #141

@dariocc

Description

@dariocc
class Foo(object):
    @property
    def bar(self):
        pass

    @bar.setter
    def bar(self, value):
        pass


def do_bar(foo):
    foo.bar = 3


def test_bar_property():
    foo = Foo()
    allow(foo).bar

    do_bar(foo)

Fails with AttributeError. Besides, it is not possible to validate what was the value passed to the setter (with_args fails cannot be used with properties).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions