def test_cart_distance(): a = [0, 1] b = [1, 0] yield assert_array_almost_equal, cart_distance(a, b), np.sqrt(2) yield assert_array_almost_equal, cart_distance([1, 0], [-1, 0]), 2 pts1 = [2, 1, 0] pts2 = [0, 1, -2] yield assert_array_almost_equal, cart_distance(pts1, pts2), np.sqrt(8) pts2 = [[0, 1, -2], [-2, 1, 0]] yield assert_array_almost_equal, cart_distance(pts1, pts2), [np.sqrt(8), 4]
def test_cart_distance(): a = [0, 1] b = [1, 0] assert_array_almost_equal(cart_distance(a, b), np.sqrt(2)) assert_array_almost_equal(cart_distance([1, 0], [-1, 0]), 2) pts1 = [2, 1, 0] pts2 = [0, 1, -2] assert_array_almost_equal(cart_distance(pts1, pts2), np.sqrt(8)) pts2 = [[0, 1, -2], [-2, 1, 0]] assert_array_almost_equal(cart_distance(pts1, pts2), [np.sqrt(8), 4])