Ejemplo n.º 1
0
    def test_loadCOnatiner(self):
        filename = "links.txt"
        Relations = Requirements.relationsParser(filename)
        Relations.parseFile()    

        container = Requirements.nodesContainer()

        Relations.loadNodeContainer(container)
        Nodes = container.getNodesArray()    

        self.assertEqual(Nodes , ["a","adios","b","hola"])  
Ejemplo n.º 2
0
    def setUp(self):
        filenameNodes = "nodes_1.txt"
        filenameLinks = "links_1.txt"
        Nodes     = Requirements.nodesParser(filenameNodes)  
        Nodes.parseFile()      
        Relations = Requirements.relationsParser(filenameLinks)
        Relations.parseFile()

        self.container = Requirements.nodesContainer()
        Nodes.loadNodeContainer(self.container)
        Relations.loadNodeContainer(self.container)
Ejemplo n.º 3
0
    def test_parseFile(self):
        filename = "links.txt"
        Relations = Requirements.relationsParser(filename)

        Relations.parseFile()

        self.assertEqual(Relations.relations , [["hola","adios"],["a","b"]])
Ejemplo n.º 4
0
 def test_addPointed(self):
     Ids = "idNodeTest"
     content= {1:2,"2":3}        
     new = Requirements.node(Ids,content)
     new.addPointed(2)
     self.assertEqual(new.Pointed, set([2]))        
     new.addPointed("test")
     self.assertEqual(new.Pointed, set([2,"test"])) 
     new.addPointed(2)
     self.assertEqual(new.Pointed, set([2,"test"])) 
Ejemplo n.º 5
0
    def test_string(self):
        # make sure the shuffled sequence does not lose any elements
        Idname = "idNodeTest"
        content= {1:2,"2":3}

        new = Requirements.node(Idname,content)
        self.assertEqual(new.getDir(), "idNodeTest") 
        self.assertEqual(new.writeNode(), 'idNodeTest [1="2" 2="3" ];')                
        new.addParent(2)
        self.assertEqual(new.getDir(), "2:idNodeTest") 
        self.assertEqual(new.writeNode(), "") 
Ejemplo n.º 6
0
    def test_new_node(self):
        # make sure the shuffled sequence does not lose any elements
        Idname = "idNodeTest"
        content= {1:2,"2":3}
        new = Requirements.node(Idname,content)

        self.assertEqual(new.Id, Idname)
        self.assertEqual(new.Content, content)
        # Pointing and pointed arrays is empty
        self.assertEqual(new.Pointing, set([]))   
        self.assertEqual(new.Pointed,  set([]))
Ejemplo n.º 7
0
 def test_Childs(self):
     Ids = "idNodeTest"
     content= {1:2,"2":3}        
     new = Requirements.node(Ids,content)
     new.addChild(2)
     self.assertEqual(new.Childs, set([2]))        
     new.removeChild("test")
     # Remove non existing node shall not do anything
     self.assertEqual(new.Childs, set([2])) 
     new.addChild("test")
     new.removeChild(2)
     self.assertEqual(new.Childs, set(["test"]))              
Ejemplo n.º 8
0
    def test_parseline(self):
        # make sure the shuffled sequence does not lose any elements
        filename = ""
        Relations = Requirements.nodesParser(filename)

        Relations.parseLine(" # UR-20 : TO do something fine   ")

        self.assertEqual(Relations.Nodes , {"UR-20":"TO do something fine"})

        Relations.parseLine(" hola <- adios ")
        Relations.parseLine("")
        self.assertEqual(Relations.Nodes , {"UR-20":"TO do something fine"})
Ejemplo n.º 9
0
    def test_parseline(self):
        # make sure the shuffled sequence does not lose any elements
        filename = ""
        Relations = Requirements.relationsParser(filename)

        Relations.parseLine(" hola -> adios      ")

        self.assertEqual(Relations.relations , [["hola","adios"]])

        Relations.parseLine(" hola <- adios ")
        Relations.parseLine("")
        self.assertEqual(Relations.relations , [["hola","adios"]])

        Relations.parseLine(" a->b  ")

        self.assertEqual(Relations.relations , [["hola","adios"],["a","b"]])
Ejemplo n.º 10
0
 def test_load_File(self):
     # make sure the shuffled sequence does not lose any elements
     filename= "out.html"
     dot = Requirements.tableGenerator(self.container, filename)
     dot.loadFile()
Ejemplo n.º 11
0
    def test_parseFile(self):
        filename = "nodes.txt"
        Relations = Requirements.nodesParser(filename)

        Relations.parseFile()
        self.assertEqual(Relations.Nodes , {"UR-10" : "Hello", "UR-20" : "TO do something fine"})
Ejemplo n.º 12
0
 def setUp(self):
     self.container = Requirements.nodesContainer()