def testBadIndex4(self): """Asserts error raise for non-positive-integer atomic index 4 input.""" with self.assertRaises(ValueError) as e: fileio.GetTorsionFromPrm( ['TORSION', '10', '11', '12', 'i', '1.0', '0.0', '1', '1']) self.assertEqual(str(e.exception), 'Torsion atom4 index must be positive integer: i')
def testBadTorsionPaths(self): """Asserts error raise for non-positive-integer torsion path number.""" with self.assertRaises(ValueError) as e: fileio.GetTorsionFromPrm( ['TORSION', '5', '4', '3', '1', '2.5', '30.0', '3', '-2']) self.assertEqual(str(e.exception), 'Torsion path number must be positive integer: -2')
def testEmptyArray(self): """Asserts error raise for empty array is input.""" with self.assertRaises(IndexError) as e: fileio.GetTorsionFromPrm([]) self.assertEqual( str(e.exception), 'Insufficient columns to parse prm file row into Torsion object: ')
def testBadTorsionFrequency(self): """Asserts error raise for non-postive-integer torsion frequency.""" with self.assertRaises(ValueError) as e: fileio.GetTorsionFromPrm( ['TORSION', '1', '2', '3', '4', '1.0', '0.0', '0', '3']) self.assertEqual( str(e.exception), 'Torsion barrier frequency must be positive integer: 0')
def testBadTorsionOffsetAngle(self): """Asserts error raise for non-numeric or out-of-bounds offset angle.""" with self.assertRaises(ValueError) as e: fileio.GetTorsionFromPrm( ['TORSION', '9999', '2', '34', '6', '0.1', '180.1', '1', '3']) self.assertEqual( str(e.exception), 'Torsion offset angle must be between -180.0 and 180.0: 180.1')
def testBadTorsionBarrier(self): """Asserts error raise for non-positive numeric torsion half-barrier.""" with self.assertRaises(ValueError) as e: fileio.GetTorsionFromPrm([ 'TORSION', '100', '101', '102', '103', '-1.0', '1.0', '2', '6' ]) self.assertEqual( str(e.exception), 'Torsion half-barrier must be positive numeric value: -1.0')
def testShortArray(self): """Asserts error raise for not enough fields in input.""" with self.assertRaises(IndexError) as e: fileio.GetTorsionFromPrm( ['TORSION', '1', '2', '3', '4', '1.0', '0.0', '1']) self.assertEqual( str(e.exception), ('Insufficient columns to parse prm file row into Torsion object: ' 'TORSION 1 2 3 4 1.0 0.0 1'))
def testArbitrary(self): """Asserts correct Torsion object for arbitrary input parameters.""" param = ['ANGLE', '62', '64', '67', '51', '10.0', '90.0', '3', '9'] test.assertObjectEqual( self, fileio.GetTorsionFromPrm(param), molecule.Torsion(61, 63, 66, 50, 10.0, 90.0, 3, 9))
def testSmallestValues(self): """Asserts correct Torsion object for smallest allowed values.""" param = ['TORSION', '1', '2', '3', '4', '0.000001', '-180.0', '1', '1'] test.assertObjectEqual( self, fileio.GetTorsionFromPrm(param), molecule.Torsion(0, 1, 2, 3, 0.000001, -180.0, 1, 1))