Esempio n. 1
0
    def test_compare_particles_equal(self):
        # given
        particle = Particle(uid=None,
                            coordinates=(10.0, 0.0, 2.0),
                            data=create_data_container())
        reference = Particle(uid=None,
                             coordinates=(10.0, 0.0, 2.0),
                             data=create_data_container())

        # this should pass without problems
        compare_particles(particle, reference, testcase=self)
Esempio n. 2
0
    def test_compare_particles_equal(self):
        # given
        particle = Particle(
            uid=None,
            coordinates=(10.0, 0.0, 2.0),
            data=create_data_container())
        reference = Particle(
            uid=None,
            coordinates=(10.0, 0.0, 2.0),
            data=create_data_container())

        # this should pass without problems
        compare_particles(particle, reference, testcase=self)
Esempio n. 3
0
    def test_compare_particles_not_equal(self):
        # given
        particle = Particle(
            uid=uuid.uuid4(),
            coordinates=(10.0, 0.0, 2.0),
            data=create_data_container())
        reference = Particle(
            uid=uuid.uuid4(),
            coordinates=(10.0, 0.0, 2.0),
            data=create_data_container())

        # when/then
        with self.assertRaises(AssertionError):
            compare_particles(particle, reference, testcase=self)

        # given
        particle = Particle(
            uid=reference.uid,
            coordinates=(340.0, 0.0, 2.0),
            data=create_data_container())

        # when/then
        with self.assertRaises(AssertionError):
            compare_particles(particle, reference, testcase=self)

        # given
        particle = Particle(
            uid=reference.uid,
            coordinates=(10.0, 0.0, 2.0),
            data=DataContainer())

        # when/then
        with self.assertRaises(AssertionError):
            compare_particles(particle, reference, testcase=self)

        # given
        particle = Particle()

        # when/then
        with self.assertRaises(AssertionError):
            compare_particles(particle, reference, testcase=self)
Esempio n. 4
0
    def test_compare_particles_not_equal(self):
        # given
        particle = Particle(uid=uuid.uuid4(),
                            coordinates=(10.0, 0.0, 2.0),
                            data=create_data_container())
        reference = Particle(uid=uuid.uuid4(),
                             coordinates=(10.0, 0.0, 2.0),
                             data=create_data_container())

        # when/then
        with self.assertRaises(AssertionError):
            compare_particles(particle, reference, testcase=self)

        # given
        particle = Particle(uid=reference.uid,
                            coordinates=(340.0, 0.0, 2.0),
                            data=create_data_container())

        # when/then
        with self.assertRaises(AssertionError):
            compare_particles(particle, reference, testcase=self)

        # given
        particle = Particle(uid=reference.uid,
                            coordinates=(10.0, 0.0, 2.0),
                            data=DataContainer())

        # when/then
        with self.assertRaises(AssertionError):
            compare_particles(particle, reference, testcase=self)

        # given
        particle = Particle()

        # when/then
        with self.assertRaises(AssertionError):
            compare_particles(particle, reference, testcase=self)