Skip to content

Possibly unintentional inconsistent behavior in property stubs #144

@kaungst

Description

@kaungst

Given this setup

// models/beetle_juice.py
class BeetleJuice:
    @property
    def defined_attribute(self):
        pass

    def defined_method(self):
        pass

// tests/models/beetle_juice_test.py
from doubles import InstanceDouble, allow
  1. This raises an doubles.exceptions.VerifyingDoubleError which seems correct:

    • allow(InstanceDouble("models.beetle_juice.BeetleJuice")).undefined_attribute
  2. This raises an AttributeError which seems odd but may make sense in the context of the next example:

    • InstanceDouble("models.beetle_juice.BeetleJuice", defined_attribute=3)
  3. This does not raise an error (maybe useful for defining 'meta' properties?):

    • InstanceDouble("models.beetle_juice.BeetleJuice", undefined_attribute=3)
  4. This does not raise an error, seems inconsistent with the AttributeError behavior in the second example:

    • InstanceDouble("models.beetle_juice.BeetleJuice", defined_method=3)

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