Exemplo n.º 1
0
    class Mock(MockInstrument):
        def __init__(self):
            super(Mock, self).__init__()
            self._value = 0

        def mockset(self, newval):
            self._value = newval

        mockproperty = rproperty(fget=None, fset=mockset, writeonly=True)
Exemplo n.º 2
0
    class Mock(MockInstrument):
        def __init__(self):
            super(Mock, self).__init__()
            self._value = 0

        def mockget(self):
            return self._value

        mockproperty = rproperty(fget=mockget, fset=None, readonly=True)
Exemplo n.º 3
0
    class Mock(MockInstrument):
        def __init__(self):
            super(Mock, self).__init__()
            self._value = 0

        def mockget(self):  # pragma: no cover
            return self._value

        mockproperty = rproperty(fget=mockget, fset=None, writeonly=True)
Exemplo n.º 4
0
    class Mock(MockInstrument):
        def __init__(self):
            super(Mock, self).__init__()
            self._value = 0

        def mockset(self, newval):  # pragma: no cover
            self._value = newval

        mockproperty = rproperty(fget=None, fset=mockset, readonly=True)
Exemplo n.º 5
0
    class Mock(MockInstrument):
        def __init__(self):
            super(Mock, self).__init__()
            self._value = 0

        def mockget(self):
            return self._value

        def mockset(self, newval):
            self._value = newval

        mockproperty = rproperty(fget=mockget, fset=mockset)
Exemplo n.º 6
0
def test_rproperty_readonly_and_writeonly():
    _ = rproperty(readonly=True, writeonly=True)
Exemplo n.º 7
0
def test_rproperty_readonly_and_writeonly():
    _ = rproperty(readonly=True, writeonly=True)
Exemplo n.º 8
0
def test_rproperty_readonly_and_writeonly():
    with pytest.raises(ValueError):
        _ = rproperty(readonly=True, writeonly=True)