Example #1
0
 def testBadCharge(self):
     """Asserts error raise for non-numeric charge input."""
     param = ['Ne', '-1.0', '0.0', '+1.0', '?']
     with self.assertRaises(ValueError) as e:
         fileio.GetAtomFromXyzq(param)
     self.assertEqual(str(e.exception),
                      'Atomic charge must be numeric value: ?')
Example #2
0
 def testBadAtomType(self):
     """Asserts error raise for non-alphanumeric atom type input."""
     param = ['_', '0.0', '0.0', '0.0', '0.0']
     with self.assertRaises(ValueError) as e:
         fileio.GetAtomFromXyzq(param)
     self.assertEqual(str(e.exception),
                      'Atom type must begin with letter: _')
Example #3
0
 def testEmptyArray(self):
     """Asserts error raise for empty string input."""
     with self.assertRaises(IndexError) as e:
         fileio.GetAtomFromXyzq([])
     self.assertEqual(
         str(e.exception),
         'Insufficient columns to parse xyzq file row into Atom object: ')
Example #4
0
 def testBadCoordinate(self):
     """Asserts error raise for non-numeric coordinate input."""
     param = ['C', '0.0', '0.0', 'A', '0.0']
     with self.assertRaises(ValueError) as e:
         fileio.GetAtomFromXyzq(param)
     self.assertEqual(
         str(e.exception),
         'Atomic coordinates must be numeric values: 0.0 0.0 A')
Example #5
0
 def testShortArray(self):
     """Asserts error raise for insufficient string size."""
     param = ['H', '0.0', '0.0', '0.0']
     with self.assertRaises(IndexError) as e:
         fileio.GetAtomFromXyzq(param)
     self.assertEqual(
         str(e.exception),
         ('Insufficient columns to parse xyzq file row into Atom object: '
          'H 0.0 0.0 0.0'))
Example #6
0
 def testArbitrary(self):
     """Asserts correct output for arbitrary Atom inputs."""
     param = ['N*', '999.9', '-0.0001', '2.0', '-0.52']
     output = molecule.Atom('N*', [999.9, -0.0001, 2.0], -0.52)
     test.assertObjectEqual(self, fileio.GetAtomFromXyzq(param), output)
Example #7
0
 def testZeroValues(self):
     """Asserts correct output for zero value numeric inputs."""
     param = ['OW', '0.0', '0.0', '0.0', '0.0']
     output = molecule.Atom('OW', [0.0, 0.0, 0.0], 0.0)
     test.assertObjectEqual(self, fileio.GetAtomFromXyzq(param), output)