Ejemplo n.º 1
0
class TestObject(object):
    
    inner = vproperty(instance=InnerObject)
    x = inner.x
    y = inner.y

    nix = vproperty(type=int, fdefault=lambda self: 0)
    niy = vproperty(type=int, fdefault=lambda self: 0)
Ejemplo n.º 2
0
 class Obj(object):
     p = vproperty()
     
     @p.getter
     def p(self):
         return self.__dict__.get('_q', 1)
     
     @p.setter
     def p(self, value):
         self.__dict__['_q'] = value
Ejemplo n.º 3
0
 class Obj2(object):
     p = vproperty()
     
     @p.type
     def ptype(self, value):
         return self.ty(value)
Ejemplo n.º 4
0
 class Obj(object):
     p = vproperty(type=int)
Ejemplo n.º 5
0
 class Obj(object):
     p = vproperty(instance=int)
Ejemplo n.º 6
0
class NotPicklable(object):
    p = vproperty()
Ejemplo n.º 7
0
 class Obj(object):
     p = vproperty()
Ejemplo n.º 8
0
 class Obj(object):
     p = vproperty()
     
     @p.default
     def p_default(self):
         return 12
Ejemplo n.º 9
0
 class Obj(object):
     p = vproperty(type=int)
     
     with self.assertRaises(ValueError):
         p.delegates_to('x')
Ejemplo n.º 10
0
class InnerObject(object):
    
    x = vproperty(fdefault=lambda self: 99)
    y = vproperty()
    nx = vproperty(type=int, fdefault=lambda self: 0)
Ejemplo n.º 11
0
 class Outer(object):
     def __init__(self, i): self.i = i
     i = vproperty(instance=Inner)
     y = i.ii
     nx = y.nx
     x = i.ii.x
Ejemplo n.º 12
0
 class Inner(object):
     def __init__(self, ii): self.ii = ii
     ii = vproperty(instance=InnerInner)
     nx = ii.nx
     x = ii.x
Ejemplo n.º 13
0
 class InnerInner(object):
     def __init__(self, x): self.x = x
     x = vproperty()
     nx = vproperty(fdefault=lambda self:0, type=int)