Exemplo n.º 1
0
    def test_equality_condition(self):
        """testing if the equality condition works here to; it is
        inherited from the parent class 'Particle'
        """

        particle1 = base_classes.Sand(x=0, y=0, diameter=10)
        particle2 = base_classes.Sand(x=0, y=0, diameter=10)
        self.assertNotEqual(particle1, particle2)
Exemplo n.º 2
0
    def test_ascending_particle_number(self):
        """testing if the particle number thing works in this class too
        in the ascending manner; it should be correctly inherited from
        the parent class 'Particle'
        """

        particle1 = base_classes.Sand(x=0, y=0, diameter=10)
        particle2 = base_classes.Sand(x=20, y=0, diameter=10)
        self.assertEqual(particle1.num + 1, particle2.num)
Exemplo n.º 3
0
    def test_shape(self):
        """testing if the 'shape' attribute of the Sand instance is
        assigned correctly
        """

        particle = base_classes.Sand(x=0, y=0, diameter=10)
        self.assertEqual(particle.shape, shapes.Circle(shapes.Point(0, 0), 10))
Exemplo n.º 4
0
    def test_shape(self):
        """testing if the 'shape' attribute of the Sand instance is
        assigned correctly; this behavior is inherited from the parent
        class 'Sand'
        """

        particle = base_classes.Sand(x=1, y=1, diameter=10)
        self.assertEqual(particle.shape, shapes.Circle(shapes.Point(1, 1), 10))
Exemplo n.º 5
0
    def test_box_num(self):
        """testing if the box_number method works here too; it is
        inherited from the parent class 'Particle'
        """

        particle = base_classes.Sand(x=1, y=1, diameter=10)
        bn = particle.box_num(nc=100, box_length=10, box_width=10)
        self.assertEqual(bn, 0)
Exemplo n.º 6
0
    def test_hashable(self):
        """testing if the particle being hashable works here too; it is
        inherited from the parent class 'Particle'
        """

        particle = base_classes.Sand(x=0, y=0, diameter=10)
        s = {particle}
        self.assertTrue(s)
Exemplo n.º 7
0
    def test_move(self):
        """testing if the Quartz instance moves correctly with the 
        given derivatives; this is inherited from the parent class
        'Particle'
        """

        particle = base_classes.Sand(x=1, y=1, diameter=10)
        particle.move(delta_x=2, delta_y=2)
        self.assertEqual(particle.x, 3)
        self.assertEqual(particle.y, 3)
        self.assertEqual(particle.shape, shapes.Circle(shapes.Point(3, 3), 10))
Exemplo n.º 8
0
    def test_attribute_assigning(self):
        """testing if all the attributes that a Sand instance should
        contain are present here; this also includes all the attributes
        and properties of the parent classes 'Particle' and 'Sand'
        """

        particle = base_classes.Sand(x=1, y=1, diameter=10)
        self.assertEqual(particle.x, 1)
        self.assertEqual(particle.y, 1)
        self.assertEqual(particle.diameter, 10)
        self.assertEqual(particle.shape, shapes.Circle(shapes.Point(1, 1), 10))
        self.assertEqual(particle.velocity, 0)
        self.assertEqual(particle.force, (0, 0, 0))
        self.assertEqual(particle.hierarchy, -1)