def test_remove():
    ce = ComposedElement()
    be = BaseElement("Test", "TestDesc", "category")
    ce.addElement(be)

    assert be == ce.getElement("Test")
    ce.removeElement("Test")
    assert (ce.getElement("Test") is None)
示例#2
0
 def _readObservationFile(self):
     """Docstring for readActionFile """
     csvObj = CSVUtil.readCSV(self.observationFile, self.delimiter)
     rows = csvObj['listRows']
     self.actionElements = ComposedElement()
     # Use for loop to print csv row by row
     for row in rows:
         be = BaseElement(row[0], row[1], row[2].lower())
         self.actionElements.addElement(be)
def test_category():
    ce = ComposedElement()
    be = BaseElement("Test", "TestDesc", "category")
    be2 = BaseElement("Test2 ", "TestDesc2", "category")
    be3 = BaseElement("Test3", "TestDesc3", "category2")

    ce.addElement(be)
    ce.addElement(be2)
    ce.addElement(be3)

    eg = ce.getElementsByCategory("category")
    assert ([be, be2] == eg or [be2, be] == eg)
def test_addElement():
    ce = ComposedElement()
    be = BaseElement("Test", "TestDesc", "category")
    ce.addElement(be)
    assert be == ce.getElement("Test")