diff --git a/.travis.yml b/.travis.yml index f8985f6b4..6d2802c6c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ install: script: - python setup.py sdist >/dev/null - echo "check_stable=False" >libpysal/config.py - - nosetests --verbose --with-coverage --cover-package=libpysal; + - nosetests --with-doctest --verbose --with-coverage --cover-package=libpysal -I shapely_ext.py; #- cd doc; make pickle; make doctest notifications: email: diff --git a/libpysal/cg/alpha_shapes.py b/libpysal/cg/alpha_shapes.py index d887c73a3..6c4eec155 100644 --- a/libpysal/cg/alpha_shapes.py +++ b/libpysal/cg/alpha_shapes.py @@ -171,7 +171,7 @@ def get_faces(triangle): Example ------- - >>> triangle = np.array([3, 1, 4], dtype=int32) + >>> triangle = np.array([3, 1, 4], dtype=np.int32) >>> faces = get_faces(triangle) >>> faces array([[3., 1.], @@ -215,11 +215,7 @@ def build_faces(faces, triangles_is, Example ------- >>> import scipy.spatial as spat - >>> pts = np.array([[0, 1], - [3, 5], - [4, 1], - [6, 7], - [9, 3]]) + >>> pts = np.array([[0, 1], [3, 5], [4, 1], [6, 7], [9, 3]]) >>> triangulation = spat.Delaunay(pts) >>> triangulation.simplices array([[3, 1, 4], @@ -229,9 +225,8 @@ def build_faces(faces, triangles_is, >>> num_triangles = triangulation.simplices.shape[0] >>> num_faces = num_triangles * num_faces_single >>> faces = np.zeros((num_faces, 2), dtype=np.int_) - >>> mask = np.ones((num_faces,), dtype=np.bool_) - >>> faces = build_faces(faces, triangulation.simplices, - num_triangles, num_faces_single) + >>> mask = np.ones((num_faces,), dtype=np.bool_) + >>> faces = build_faces(faces, triangulation.simplices, num_triangles, num_faces_single) >>> faces array([[3, 1], [1, 4], @@ -273,17 +268,9 @@ def nb_mask_faces(mask, faces): Example ------- - - >>> faces = array([[0, 1], - [0, 2], - [1, 2], - [1, 2], - [1, 3], - [1, 4], - [1, 4], - [2, 4], - [3, 4]]) - >>> mask = np.ones((faces.shape[0], ), dtype=bool_) + >>> import numpy as np + >>> faces = np.array([[0, 1], [0, 2], [1, 2], [1, 2], [1, 3], [1, 4], [1, 4], [2, 4], [3, 4]]) + >>> mask = np.ones((faces.shape[0], ), dtype=np.bool_) >>> masked = nb_mask_faces(mask, faces) >>> masked array([[0, 1], diff --git a/libpysal/io/iohandlers/gal.py b/libpysal/io/iohandlers/gal.py index a94c90eda..98ba5f4f5 100644 --- a/libpysal/io/iohandlers/gal.py +++ b/libpysal/io/iohandlers/gal.py @@ -71,8 +71,8 @@ def _read(self): >>> w = testfile.read() >>> w.n == 100 True - >>> w.sd == 1.5151237573214935 - True + >>> print(round(w.sd,6)) + 1.515124 >>> testfile = pysal.open(pysal.examples.get_path('sids2.gal'),'r') Return a sparse matrix for the w information diff --git a/libpysal/weights/util.py b/libpysal/weights/util.py index ee1c6e84a..7480d4cbb 100644 --- a/libpysal/weights/util.py +++ b/libpysal/weights/util.py @@ -1486,8 +1486,8 @@ def fuzzy_contiguity(gdf, tolerance=0.005, buffering=False, drop=True): >>> wf = fuzzy_contiguity(rs_df) >>> wf.islands [] - >>> wf[0] - {239: 1.0, 59: 1.0, 152: 1.0, 23: 1.0, 107: 1.0} + >>> wf[0] == dict({239: 1.0, 59: 1.0, 152: 1.0, 23: 1.0, 107: 1.0}) + True Example needing to use buffering