def test_ListOf_copyConstructor(self): o1 = libsbml.ListOf(2,1) s = libsbml.Species(2,1) s.setId("species_1") o1.append(s) s = None o2 = libsbml.ListOf(o1) self.assert_( o2.size() == 1 ) self.assert_( o2.get(0).getId() == "species_1" ) self.assert_( o2.getParentSBMLObject() == o1.getParentSBMLObject() ) o2 = None o1 = None pass
def test_ListOf_clear(self): lo = libsbml.ListOf(2,4) sp = libsbml.Species(2,4) lo.append(sp) lo.append(sp) lo.append(sp) lo.append(sp) lo.append(sp) self.assert_( lo.size() == 5 ) lo.clear(True) self.assert_( lo.size() == 0 ) lo.append(sp) lo.append(sp) lo.append(sp) lo.append(sp) lo.appendAndOwn(sp) self.assert_( lo.size() == 5 ) elem = lo.get(0) _dummyList = [ elem ]; _dummyList[:] = []; del _dummyList elem = lo.get(1) _dummyList = [ elem ]; _dummyList[:] = []; del _dummyList elem = lo.get(2) _dummyList = [ elem ]; _dummyList[:] = []; del _dummyList elem = lo.get(3) _dummyList = [ elem ]; _dummyList[:] = []; del _dummyList elem = lo.get(4) _dummyList = [ elem ]; _dummyList[:] = []; del _dummyList lo.clear(False) self.assert_( lo.size() == 0 ) _dummyList = [ lo ]; _dummyList[:] = []; del _dummyList pass
def test_ListOf_remove(self): lo = libsbml.ListOf(2,4) sp = libsbml.Species(2,4) self.assert_( lo.size() == 0 ) lo.append(sp) lo.append(sp) lo.append(sp) lo.append(sp) lo.append(sp) self.assert_( lo.size() == 5 ) elem = lo.remove(0) _dummyList = [ elem ]; _dummyList[:] = []; del _dummyList elem = lo.remove(0) _dummyList = [ elem ]; _dummyList[:] = []; del _dummyList elem = lo.remove(0) _dummyList = [ elem ]; _dummyList[:] = []; del _dummyList elem = lo.remove(0) _dummyList = [ elem ]; _dummyList[:] = []; del _dummyList elem = lo.remove(0) _dummyList = [ elem ]; _dummyList[:] = []; del _dummyList self.assert_( lo.size() == 0 ) lo.append(sp) lo.append(sp) lo.append(sp) lo.append(sp) lo.appendAndOwn(sp) self.assert_( lo.size() == 5 ) _dummyList = [ lo ]; _dummyList[:] = []; del _dummyList pass
def test_ListOf_create(self): lo = libsbml.ListOf(2,4) self.assert_( lo.getTypeCode() == libsbml.SBML_LIST_OF ) self.assert_( lo.getNotes() == None ) self.assert_( lo.getAnnotation() == None ) self.assert_( lo.getMetaId() == "" ) self.assert_( lo.size() == 0 ) _dummyList = [ lo ]; _dummyList[:] = []; del _dummyList pass