assert len(forms[2].select.keys()) == 2 assert len(forms[2].input.keys()) == 2 # testing comboboxes: assert len(forms[2].select['what-to-do']['options']) == 5 assert forms[2].select['what-to-do']['options'][0] == 'Drink Coffee' assert len(forms[2].select['who-to-do-it-with']['options']) == 6 assert forms[2].select['who-to-do-it-with']['options'][-1] == 'Chouck' ########################################################################## # FORM 3 # form[3] has 3 textareas (TEXTAREA) and 2 buttons (INPUT) print forms[3].textarea assert len(forms[3].textarea.items()) == 3 assert len(forms[3].input) == 2 # testing textareas: assert forms[3].textarea['positive']['cols'] == '60' assert forms[3].textarea['positive']['rows'] == '20' assert forms[3].textarea['username']['text'][0] == 'Your Name Here' harness = testplus.TestHarness( __name__, funs=testplus.testcollect(globals()), ) if __name__ == '__main__': print harness sys.exit(len(harness))
prot = res.findType(Protein, uniq=1) assert len(prot) == 1 and prot == mol.setClass([mol]) # FindType below from middle of the tree atoms = chainsuniq.findType(Atom) assert len(atoms) == 327 # FindType on empty set emptyres = ResidueSet([]) atoms = emptyres.findType(Atom) assert len(atoms) == 0 and isinstance(atoms, AtomSet) # FindType on same type atoms = atms.findType(Atom) assert atoms == atms # Raise exception from MolKit.protein import Helix try: nodes = atms.findType(Helix) except RuntimeError: print "passed" harness = testplus.TestHarness(__name__, funs=testplus.testcollect(globals())) if __name__ == "__main__": print harness sys.exit(len(harness))
b = Object() c = Object(name='cube', color = 'red', shape='square') t = Object(name='triangle', color='yellow', shape='triangle') d = Object(name='disk', color='silver', shape='round') from MolKit.listSet import ListSet testList = ListSet([b,c,t], elementType=Object) assert len(testList) == 3 assert testList.color == ['blue', 'red', 'yellow'] testList.color = ['green', 'yellow', 'cyan', ] assert b.color == 'green' and c.color=='yellow' and t.color == 'cyan' testList.append(d) assert len(testList) == 4 assert testList.color == ['green', 'yellow', 'cyan', 'silver'] def test_ListSet_loopoveremptyset(): from MolKit.listSet import ListSet testList = ListSet([]) for l in testList: print l.__str__() del testList harness = testplus.TestHarness( __name__, funs = testplus.testcollect( globals()), ) if __name__ == '__main__': testplus.chdir() print harness sys.exit( len( harness))
rings.findRings2(atoms, bonds) assert rings.ringCount == 6 def test_findCycles2(): # test cycle detection on modified taxol to have 5 membered ring atoms, bonds = getGraphFromFile("fuzedRings2.graph") from PyBabel.cycle import RingFinder rings = RingFinder() rings.findRings2(atoms, bonds) assert rings.ringCount == 4 def test_findCycles3(): # test cycle detection on taxol merged rings only atoms, bonds = getGraphFromFile("fuzedRings1.graph") from PyBabel.cycle import RingFinder rings = RingFinder() rings.findRings2(atoms, bonds) assert rings.ringCount == 4 harness = testplus.TestHarness("PyBabel_cycles", funs=testplus.testcollect(globals())) if __name__ == "__main__": testplus.chdir() print harness sys.exit(len(harness))