def test_operation(self): instance = UMLObject() operation = Mock() instance.add_operation(operation) result = instance.operations()[0] self.assertEquals(result, operation)
def test_attribute(self): instance = UMLObject() attribute = Mock() instance.add_attribute(attribute) result = instance.attributes()[0] self.assertEquals(result, attribute)
def test_not_eq_operation(self): instance = UMLObject() other = UMLObject() (o1, o2) = (Mock(), Mock()) instance.add_operation(o1) instance.add_operation(o2) self.assertNotEqual(instance, other)
def setUp(self): relation = UMLObject() relation.name = "relation" association = UMLObject() association.name = "association" association.parent = "relation" association["arrow"] = "association" association["direction"] = "none" one_to_many = UMLObject() one_to_many.name = "one-to-many" one_to_many.parent = "association" one_to_many["source-count"] = "1" one_to_many["target-count"] = "*" list = [relation, association, one_to_many] self.uml_objects = dict((object.name, object) for object in list)
def test_eq_operation(self): instance = UMLObject() other = UMLObject() o1 = MagicMock() o1.__eq__.return_value = True o2 = MagicMock() o2.__eq__.return_value = True instance.add_operation(o1) other.add_operation(o2) self.assertEqual(instance, other)