예제 #1
0
    def test_operation(self):
        instance = UMLObject()
        operation = Mock()
        instance.add_operation(operation)
        result = instance.operations()[0]

        self.assertEquals(result, operation)
예제 #2
0
    def test_attribute(self):
        instance = UMLObject()
        attribute = Mock()

        instance.add_attribute(attribute)
        result = instance.attributes()[0]

        self.assertEquals(result, attribute)
예제 #3
0
    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)
예제 #4
0
    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)
예제 #5
0
    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)