def test_association_end_with_applied_stereotype(factory): a = factory.create(UML.Property) a.association = factory.create(UML.Association) parse(a, "myattr[1]") add_tag_is_foo_metadata_field(a, factory) assert ("+ myattr", '1 { tag = "foo" }') == format_association_end(a)
def test_association_end(factory, text, name_part, mult_part): """Test simple attribute formatting.""" a = factory.create(UML.Property) a.association = factory.create(UML.Association) parse(a, text) assert (name_part, mult_part) == format_association_end(a)
def set_text(self): """Set the text on the association end.""" if self.subject: try: n, m = format_association_end(self.subject) except ValueError: # need more than 0 values to unpack: property was rendered as # attribute while in a UNDO action for example. pass else: self._name = n self._mult = m self.request_update()