Exemple #1
0
 def testBadEquilibriumBondLength(self):
     """Asserts error raise for negative or non-numeric equilibrium length."""
     with self.assertRaises(ValueError) as e:
         fileio.GetBondFromPrm(['BOND', '10000', '3', '0.1', '#'])
     self.assertEqual(
         str(e.exception),
         'Equilibrium bond length must be positive numeric value: #')
Exemple #2
0
 def testBadBondSpringConstant(self):
     """Asserts error raise for non-positive numeric bond spring constant."""
     with self.assertRaises(ValueError) as e:
         fileio.GetBondFromPrm(['BOND', '100', '101', '0.0', '1.0'])
     self.assertEqual(
         str(e.exception),
         'Bond spring constant must be positive numeric value: 0.0')
Exemple #3
0
 def testEmptyArray(self):
     """Asserts error raise for empty array is input."""
     with self.assertRaises(IndexError) as e:
         fileio.GetBondFromPrm([])
     self.assertEqual(
         str(e.exception),
         'Insufficient columns to parse prm file row into Bond object: ')
Exemple #4
0
 def testShortArray(self):
     """Asserts error raise for not enough fields in input."""
     with self.assertRaises(IndexError) as e:
         fileio.GetBondFromPrm(['BOND', '1', '2', '1.0'])
     self.assertEqual(
         str(e.exception),
         ('Insufficient columns to parse prm file row into Bond object: '
          'BOND 1 2 1.0'))
Exemple #5
0
 def testArbitrary(self):
     """Asserts correct Bond object for arbitrary input parameters."""
     param = ['BOND', '455', '27', '8.484', '6.63']
     test.assertObjectEqual(self, fileio.GetBondFromPrm(param),
                            molecule.Bond(454, 26, 8.484, 6.63))
Exemple #6
0
 def testSmallestValues(self):
     """Asserts correct Bond object for smallest allowed values."""
     param = ['BOND', '1', '2', '0.000001', '0.000001']
     test.assertObjectEqual(self, fileio.GetBondFromPrm(param),
                            molecule.Bond(0, 1, 0.000001, 0.000001))
Exemple #7
0
 def testBadIndex2(self):
     """Asserts error raise for non-positive-integer atomic index 2 input."""
     with self.assertRaises(ValueError) as e:
         fileio.GetBondFromPrm(['BOND', '2', 'A', '1.0', '1.0'])
     self.assertEqual(str(e.exception),
                      'Bond atom2 index must be positive integer: A')