예제 #1
0
    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')
예제 #2
0
    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')
예제 #3
0
    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!')
예제 #4
0
    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!')
예제 #5
0
    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!')
예제 #6
0
    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!')
예제 #7
0
    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!')
예제 #8
0
    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!')