0
有没有人知道一个嘲弄或残留的框架,它允许属性甚至类属性像这样的装饰器呢?蟒蛇属性框架
class classproperty:
"""
Decorator to read-only static properties
"""
def __init__(self, getter):
self.getter = getter
def __get__(self, instance, owner):
return self.getter(owner)
class Foo:
_name = "Name"
@classproperty
def foo(cls):
return cls._name
我目前使用的是mockito,但是这不允许存储属性的残留。