예제 #1
0
파일: test_data.py 프로젝트: wrobell/piuml
    def test_unwind(self):
        """
        Test unwind
        """
        n1 = Diagram()
        n1.id = 'n1'

        n2 = PackagingElement('a', id='n2')
        n3 = PackagingElement('a', id='n3')
        n4 = Element('a', id='n4')

        n1.children.extend((n2, n3))
        n2.children.append(n4)

        n2.parent = n1
        n3.parent = n1
        n4.parent = n2

        self.assertEquals([n1, n2, n4, n3], list(unwind(n1)))
예제 #2
0
파일: test_data.py 프로젝트: wrobell/piuml
    def test_lca_order(self):
        """
        Test LCA ordering
        """
        n1 = Diagram()
        n1.id = 'd1'

        n2 = Element('a', id='n2')
        n3 = PackagingElement('a', id='dc2')
        n4 = Element('a', id='n4')
        n5 = Element('a', id='n5')
        n1.children.extend((n2, n3))
        n2.parent = n1
        n3.parent = n1

        n3.children.extend((n4, n5))
        n4.parent = n3
        n5.parent = n3

        p = lca(n1, n4, n5)
        self.assertEquals('dc2', p.id)
예제 #3
0
파일: test_data.py 프로젝트: wrobell/piuml
    def test_lsb(self):
        """
        Test LSB
        """
        n1 = Diagram()
        n1.id = 'n1'

        n2 = PackagingElement('a', id='n2')
        n3 = PackagingElement('a', id='n3')
        n4 = PackagingElement('a', id='n4')

        n1.children.extend((n2, n3))
        n2.children.append(n4)

        n2.parent = n1
        n3.parent = n1
        n4.parent = n2

        siblings = lsb(n1, n3, n4)
        self.assertEquals([n3, n2], siblings)