1   
  2   
  3   
  4   
  5   
  6   
  7   
  8   
  9   
 10   
 11   
 12   
 13   
 14   
 15   
 16   
 17   
 18   
 19   
 20   
 21   
 22   
 23  from unittest import TestCase 
 24   
 25   
 26  from data_store.mol_res_spin import MoleculeList 
 27   
 28   
 30      """Unit tests for the data.mol_res_spin relax module.""" 
 31   
 33          """Create a mol-res-spin structure for testing all the object methods.""" 
 34   
 35           
 36          self.mol = MoleculeList() 
 37   
 38           
 39          self.mol[0].res[0].spin[0].x = 1 
  40   
 41   
 43          """Unit test for the 'add_item()' method of the MolecularList class.""" 
 44   
 45           
 46          name = 'Ap4Aase' 
 47   
 48           
 49          self.mol.add_item(mol_name=name) 
 50   
 51           
 52          self.assertEqual(self.mol[1].name, name) 
 53   
 54           
 55          self.assert_(not hasattr(self.mol[1].res[0].spin[0], 'x')) 
  56   
 57   
 59          """Unit test for the 'add_item()' method of the ResidueList class.""" 
 60   
 61           
 62          name = 'LEU' 
 63          num = -5 
 64   
 65           
 66          self.mol[0].res.add_item(res_name=name, res_num=num) 
 67   
 68           
 69          self.assertEqual(self.mol[0].res[1].name, name) 
 70          self.assertEqual(self.mol[0].res[1].num, num) 
 71   
 72           
 73          self.assert_(not hasattr(self.mol[0].res[1].spin[0], 'x')) 
  74   
 75   
 77          """Unit test for the 'add_item()' method of the SpinList class.""" 
 78   
 79           
 80          name = 'N' 
 81          num = 1409 
 82   
 83           
 84          self.mol[0].res[0].spin.add_item(spin_name=name, spin_num=num, select=0) 
 85   
 86           
 87          self.assertEqual(self.mol[0].res[0].spin[1].name, name) 
 88          self.assertEqual(self.mol[0].res[0].spin[1].num, num) 
 89          self.assertEqual(self.mol[0].res[0].spin[1].select, 0) 
 90   
 91           
 92          self.assert_(not hasattr(self.mol[0].res[0].spin[1], 'x')) 
  93   
 94   
 96          """Unit test for the validity of the MoleculeContainer.__repr__() method.""" 
 97   
 98           
 99          self.assert_(type(self.mol[0].__repr__()), str) 
 100   
101   
103          """Unit test for the validity of the MoleculeList.__repr__() method.""" 
104   
105           
106          self.assert_(type(self.mol.__repr__()), str) 
 107   
108   
110          """Unit test for the validity of the ResidueContainer.__repr__() method.""" 
111   
112           
113          self.assert_(type(self.mol[0].res[0].__repr__()), str) 
 114   
115   
117          """Unit test for the validity of the ResidueList.__repr__() method.""" 
118   
119           
120          self.assert_(type(self.mol[0].res.__repr__()), str) 
 121   
122   
124          """Unit test for the validity of the SpinContainer.__repr__() method.""" 
125   
126           
127          self.assert_(type(self.mol[0].res[0].spin[0].__repr__()), str) 
 128   
129   
131          """Unit test for the validity of the SpinList.__repr__() method.""" 
132   
133           
134          self.assert_(type(self.mol[0].res[0].spin.__repr__()), str) 
  135