def test_com_pentagon(self): # Make sure center of mass works right for a pentagon. result = center_of_mass(self.pentagon) benchmark = array([19.0 / 21.0, 19.0 / 21.0], dtype="float") assert_allclose(result, benchmark)
def test_com_square(self): # Make sure center of mass works right for a square. result = center_of_mass(self.square) benchmark = array([1.0 / 2.0, 1.0 / 2.0], dtype="float") assert_allclose(result, benchmark)
def test_com_trapezoid(self): # Make sure center of mass works right for a trapezoid. result = center_of_mass(self.trapezoid) benchmark = array([7.0 / 9.0, 4.0 / 9.0], dtype="float") assert_allclose(result, benchmark)
def test_com_triangle2(self): # Make sure center of mass works right for another triangle. result = center_of_mass(self.triangle2) benchmark = array([2.0 / 3.0, 1.0 / 3.0], dtype="float") assert_allclose(result, benchmark)