Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@mutableproperty
def a(self):
"A mutable event sourced property."
@mutableproperty
def first_char_index(self):
"""Index of start of string part represented by this edge.
"""
return self._first_char_index
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)
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'
@mutableproperty
def string(self):
return self._string
@mutableproperty
def b(self):
return self._b
@mutableproperty
def source_node_id(self):
"""Id of source node of edge.
"""
return self._source_node_id
@mutableproperty
def dest_node_id(self):
"""Id of destination node of edge.
"""
return self._dest_node_id
@mutableproperty
def source_node_id(self):
"""Id of source node of edge.
"""
return self._source_node_id
@mutableproperty
def string_id(self):
"""The id of a string being added to the generalised suffix tree when this node was created.
"""