def test_select_set_from_string(self): """ test result using key into Sets """ sets = Sets() subset = self.mols.allAtoms[:3] set_name = 'first_three_atoms' sets.add(set_name, subset) selString = ':::' + set_name css = CompoundStringSelector() result, msg = css.select(self.mols, selString, sets=sets) self.assertEqual(result, subset) self.assertEquals(result.stringRepr, selString)
def test_select_set_from_string(self): """ test result using string which is key in Sets dict """ sets = Sets() subset = self.molecules[0].allAtoms set_name = 'first' sets.add(set_name, subset) selString = ':::' + set_name stringSel = StringSelector() result, msg = stringSel.select(self.molecules, selString, sets=sets) self.assertEqual(result, subset) self.assertEquals(result.stringRepr, selString)
def test_select_valid_set(self): """ test string with valid set name returns 1 set """ these_sets = Sets() key = 'first' these_sets.add(key, self.bonds[1:]) selString = key result, msg = self.stringSel.select(self.bonds, selString, sets=these_sets) #print "result=", result self.assertEquals(len(result), 23) self.assertEquals(result, self.bonds[1:])
def test_select_valid_set(self): """ test string with valid set name returns 1 set """ these_sets = Sets() new_set = self.atoms[:10] key = 'first_atoms' these_sets.add(key, new_set) selString = key result, msg = self.stringSel.select(self.atoms, selString, sets=these_sets) self.assertEquals(len(result), len(new_set)) self.assertEquals(result, new_set)
def test_select_valid_set(self): """ test string with valid set name returns 1 set """ new_mols = Read("Data/1crn.pdb") self.mols +=new_mols these_sets = Sets() key = 'first' these_sets.add(key, self.mols[1:]) selString = key result, msg = self.stringSel.select(self.mols, selString, sets=these_sets) #print "result=", result self.assertEquals(len(result), 1) self.assertEquals(result, self.mols[1:])
def setUp(self): self.mol = Read('Data/1crn.pdb')[0] self.sets = Sets()
def test_constructor(self): """ test creating an empty sets instance """ sets = Sets() self.assertEquals(sets.__class__, Sets)