Exemplo n.º 1
0
 def test_attributes(self):
     attrs = ["+b", "-a"]
     o = UMLObject()
     [o.add_attribute(attr) for attr in reversed(attrs)]
     
     instance = Drawable(o)
     self.assertEqual(attrs, instance.attributes())
Exemplo n.º 2
0
 def test_operations(self):
     ops = ["+b()", "-a()"]
     o = UMLObject()
     [o.add_operation(op) for op in reversed(ops)]
     
     instance = Drawable(o)
     self.assertEqual(ops, instance.operations())
Exemplo n.º 3
0
 def test_operation(self):
     instance = UMLObject()
     operation = "+operation()"
     
     instance.add_operation(operation)
     result = instance.operations()[0]
     
     self.assertEquals(result, operation)
Exemplo n.º 4
0
 def test_attribute(self):
     instance = UMLObject()
     attribute = "+attribute"
     
     instance.add_attribute(attribute)
     result = instance.attributes()[0]
     
     self.assertEquals(attribute, result)
Exemplo n.º 5
0
 def test_sorting(self):
     instance = UMLObject()
     data = ["+a", "-z", "#z", "#c", "-b", "+c"]
     
     [instance.add_attribute(attr) for attr in data]
     [instance.add_operation(op+"()") for op in data]
     
     attrs = instance.attributes()
     ops = instance.operations()
     
     self.assertEquals(["+a", "+c", "#c","#z","-b","-z"], attrs)
     self.assertEquals(["+a()", "+c()", "#c()","#z()","-b()","-z()"], ops)
Exemplo n.º 6
0
 def test_root_property(self):
     instance = UMLObject()
     m = Mock()
     
     instance.root = m
     self.assertEqual(m, instance.root)