def test_addition(self):
        np = numpy

        testdEs = np.linspace(-1E6, 1E6, 2000000)
        testdts = np.linspace(0, 10E-9, 2000000)
        self.beam.dE = testdEs
        self.beam.dt = testdts

        testdEs = np.linspace(-2E6, 2E6, 100000)
        testdts = np.linspace(-1E-9, 12E-9, 100000)

        self.beam.add_particles([testdts, testdEs])

        self.assertEqual(self.beam.n_macroparticles, 2100000,
                         msg="n_macroparticles not incremented correctly")

        testBeam = Beam(self.general_params, 200, 0)

        testBeam.id[:100] = 0

        self.beam.add_beam(testBeam)

        self.assertEqual(self.beam.id[2100000:2100100].tolist(), [0]*100,
                         msg="particle ids not applied correctly")

        self.assertEqual(self.beam.n_macroparticles, 2100200,
                         msg="Added macroparticles not incremented n_macro correctly")

        self.beam += testBeam

        self.assertEqual(self.beam.n_macroparticles, 2100400,
                         msg="Added macroparticles not incremented n_macro correctly")

        self.beam += (testdts, testdEs)

        self.assertEqual(self.beam.n_macroparticles, 2200400,
                         msg="Added macroparticles not incremented n_macro correctly")

        self.assertEqual(-2E6, np.min(self.beam.dE),
                         msg="coordinates of added beam not used correctly")
        self.assertEqual(2E6, np.max(self.beam.dE),
                         msg="coordinates of added beam not used correctly")
        self.assertEqual(-1E-9, np.min(self.beam.dt),
                         msg="coordinates of added beam not used correctly")
        self.assertEqual(12E-9, np.max(self.beam.dt),
                         msg="coordinates of added beam not used correctly")

        with self.assertRaises(blExcept.ParticleAdditionError,
                               msg="""Unequal length time and energy should raise exception"""):

            self.beam += ([1, 2, 3], [4, 5])

        with self.assertRaises(blExcept.ParticleAdditionError,
                               msg="""Mising time/energy should raise exception"""):

            self.beam += ([1, 2, 3])

        with self.assertRaises(TypeError, msg='Wrong type should raise exception'):
            self.beam.add_beam(([1], [2]))