Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #6
0
def test_rproperty_readonly_and_writeonly():
    _ = rproperty(readonly=True, writeonly=True)
Example #7
0
def test_rproperty_readonly_and_writeonly():
    _ = rproperty(readonly=True, writeonly=True)
Example #8
0
def test_rproperty_readonly_and_writeonly():
    with pytest.raises(ValueError):
        _ = rproperty(readonly=True, writeonly=True)