How to use the eventsourcing.domain.model.entity.mutableproperty function in eventsourcing

To help you get started, we’ve selected a few eventsourcing examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github johnbywater / eventsourcing / eventsourcingtests / test_entity.py View on Github external
            @mutableproperty
            def a(self):
                "A mutable event sourced property."
github johnbywater / eventsourcing / eventsourcingtests / test_suffix_tree.py View on Github external
    @mutableproperty
    def first_char_index(self):
        """Index of start of string part represented by this edge.
        """
        return self._first_char_index
github johnbywater / eventsourcing / eventsourcingtests / test_entity.py View on Github external
def test_mutableproperty(self):
        # Check we get an error when called with something other than a function.
        self.assertRaises(ProgrammingError, mutableproperty, 'not a getter')
        self.assertRaises(ProgrammingError, mutableproperty, 123)
        self.assertRaises(ProgrammingError, mutableproperty, None)

        # Call the decorator with a function.
        getter = lambda: None
        p = mutableproperty(getter)

        # Check we got a property object.
        self.assertIsInstance(p, property)

        # Check the property object has both setter and getter functions.
        self.assertTrue(p.fset)
        self.assertTrue(p.fget)

        # Pretend we decorated an object.
        o = EventSourcedEntity(entity_id='1', entity_version=1, domain_event_id=1)
github johnbywater / eventsourcing / eventsourcingtests / test_entity.py View on Github external
def test_mutableproperty(self):
        # Check we get an error when called with something other than a function.
        self.assertRaises(ProgrammingError, mutableproperty, 'not a getter')
        self.assertRaises(ProgrammingError, mutableproperty, 123)
        self.assertRaises(ProgrammingError, mutableproperty, None)

        # Call the decorator with a function.
        getter = lambda: None
        p = mutableproperty(getter)

        # Check we got a property object.
        self.assertIsInstance(p, property)

        # Check the property object has both setter and getter functions.
        self.assertTrue(p.fset)
        self.assertTrue(p.fget)

        # Pretend we decorated an object.
        o = EventSourcedEntity(entity_id='1', entity_version=1, domain_event_id=1)
        o.__dict__['_'] = 'value1'
github johnbywater / eventsourcing / suffixtrees / domain / model / suffixtree.py View on Github external
    @mutableproperty
    def source_node_id(self):
        """Id of source node of edge.
        """
        return self._source_node_id
github johnbywater / eventsourcing / suffixtrees / domain / model / suffixtree.py View on Github external
    @mutableproperty
    def dest_node_id(self):
        """Id of destination node of edge.
        """
        return self._dest_node_id
github johnbywater / eventsourcing / suffixtrees / domain / model / generalizedsuffixtree.py View on Github external
    @mutableproperty
    def source_node_id(self):
        """Id of source node of edge.
        """
        return self._source_node_id
github johnbywater / eventsourcing / suffixtrees / domain / model / generalizedsuffixtree.py View on Github external
    @mutableproperty
    def string_id(self):
        """The id of a string being added to the generalised suffix tree when this node was created.
        """