def test_return_values(self, clamp): """Test if the method returns expected values""" min_Clamp, max_Clamp = (0, 1) if clamp is None else clamp velocity = P.generate_velocity( n_particles=2, dimensions=3, clamp=clamp ) assert (velocity <= max_Clamp).all() and (velocity >= min_Clamp).all()
def test_generate_velocity_return_values(clamp): """Tests if generate_velocity() returns expected values""" min_clamp, max_clamp = (0, 1) if clamp == None else clamp velocity = P.generate_velocity(n_particles=2, dimensions=3, clamp=clamp) assert (velocity <= max_clamp).all() and (velocity >= min_clamp).all()
def test_invalid_clamp_type(self, clamp): """Test if method raises a TypeError given invalid clamp type""" with pytest.raises(TypeError): P.generate_velocity(n_particles=2, dimensions=3, clamp=clamp)
def test_invalid_clamp_value(self, clamp): """Test if the method raises a ValueError given invalid clamp size""" with pytest.raises(ValueError): P.generate_velocity(n_particles=2, dimensions=3, clamp= clamp)