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: #')
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')
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: ')
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'))
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))
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))
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')