uber/doubles

Possibly unintentional inconsistent behavior in property stubs

Opened this issue · 0 comments

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)