def test_convert_data_exception(self): with self.assertRaisesRegex( RuntimeError, 'ERROR in Ring: Synchronous data type not recognized!', msg='No RuntimeError for wrong synchronous data type!'): convert_data(25e9, self.particle.mass, self.particle.charge, synchronous_data_type='somethingCompletelyDifferent')
def test_convert_data_wrong_kinetic_energy(self): # use negative kinetic energy self.assertIsNaN( convert_data(-25, self.particle.mass, self.particle.charge, synchronous_data_type='kinetic energy'), msg='No NaN for total energy less than rest mass!')
def test_convert_data_wrong_total_energy(self): # use energy 25 instead of 25e9 self.assertIsNaN( convert_data(25, self.particle.mass, self.particle.charge, synchronous_data_type='total energy'), msg='No NaN for total energy less than rest mass!')
def test_convert_data_wrong_kinetic_energy(self): # use negative kinetic energy self.assertIsNaN(convert_data(-25, self.particle.mass, self.particle.charge, synchronous_data_type='kinetic energy'), msg='No NaN for total energy less than rest mass!')
def test_convert_data_wrong_total_energy(self): # use energy 25 instead of 25e9 self.assertIsNaN(convert_data(25, self.particle.mass, self.particle.charge, synchronous_data_type='total energy'), msg='No NaN for total energy less than rest mass!')
def test_convert_data_value_rest_mass(self): self.assertEqual( convert_data( Electron().mass, Electron().mass, Electron().charge, synchronous_data_type='total energy'), 0.0, msg='Momentum not zero for total engery equal rest mass!')
def test_convert_data_value_rest_mass(self): self.assertEqual( convert_data(Electron().mass, Electron().mass, Electron().charge, synchronous_data_type='total energy'), 0.0, msg='Momentum not zero for total engery equal rest mass!')