コード例 #1
0
 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)
コード例 #2
0
 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)
コード例 #3
0
 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)
コード例 #4
0
 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:])
コード例 #5
0
 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)
コード例 #6
0
 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:])
コード例 #7
0
 def setUp(self):
     self.mol = Read('Data/1crn.pdb')[0]
     self.sets = Sets()
コード例 #8
0
 def test_constructor(self):
     """
     test creating an empty sets instance
     """
     sets = Sets()
     self.assertEquals(sets.__class__, Sets)