コード例 #1
0
 def test_align(self):
     # test for previous bug which caused unintended deletion of
     # source/target nodes with the same name
     gp = GraphMatching(self.banks, self.graphs)
     
     nodes1 = Pair("1", "2")
     nodes2 = Pair("2", "1")
     rel = "equals"
     
     gp.add_align(nodes1, rel)
     gp.add_align(nodes2, rel)
     gp.del_align(nodes1)
     self.assertTrue(gp.get_align(nodes2))
コード例 #2
0
    def test_align(self):
        gp = GraphMatching(self.banks, self.graphs)
        
        nodes1 = Pair("1", "2")
        nodes2 = Pair("2", "3")
        nodes3 = Pair("1", "4")
        rel = "equals"
        
        gp.add_align(nodes1, rel)
        self.assertTrue(gp.get_align(nodes1))
        
        gp.add_align(nodes2, rel)
        self.assertTrue(gp.get_align(nodes1))
        self.assertTrue(gp.get_align(nodes2))
        
        gp.add_align(nodes3, rel)
        self.assertFalse(gp.get_align(nodes1))
        self.assertTrue(gp.get_align(nodes2))
        self.assertTrue(gp.get_align(nodes3))

        gp.del_align(nodes2)
        self.assertFalse(gp.get_align(nodes2))        
        self.assertFalse(gp.has_node("2"))
        self.assertFalse(gp.has_node("3"))
        
        gp.del_align(nodes3)
        self.assertFalse(gp.nodes())