Skip to content

Commit

Permalink
Edit doctests to pass in sphinx
Browse files Browse the repository at this point in the history
Command make doctest runs all tests in documentation. More imports were needed to pass the tests.
  • Loading branch information
Andrew Hynes committed Mar 6, 2019
1 parent 8aa3e0e commit bc9aa3f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
'sphinx.ext.napoleon', # For numpy docstrings
'sphinx.ext.doctest',
]

# Add any paths that contain templates here, relative to this directory.
Expand Down
2 changes: 2 additions & 0 deletions skspatial/measurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def area_triangle(point_a, point_b, point_c):
Examples
--------
>>> from skspatial.measurement import area_triangle
>>> from skspatial.objects import Point
>>> area_triangle(Point([0, 0]), Point([0, 1]), Point([1, 0]))
Expand Down Expand Up @@ -79,6 +80,7 @@ def volume_tetrahedron(point_a, point_b, point_c, point_d):
Examples
--------
>>> from skspatial.measurement import volume_tetrahedron
>>> from skspatial.objects import Point
>>> volume_tetrahedron(Point([0, 0]), Point([3, 2]), Point([-3, 5]), Point([1, 8]))
Expand Down
15 changes: 15 additions & 0 deletions skspatial/objects/array_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def is_collinear(self, point_a, point_b, **kwargs):
Examples
--------
>>> from skspatial.objects import Point
>>> Point([0, 1]).is_collinear(Point([1, 0]), Point([1, 2]))
False
Expand Down Expand Up @@ -145,6 +147,8 @@ def from_points(cls, point_a, point_b):
Examples
--------
>>> from skspatial.objects import Point, Vector
>>> Vector.from_points(Point((0, 0)), Point((1, 0)))
Vector([1. 0. 0.])
Expand Down Expand Up @@ -187,6 +191,8 @@ def is_zero(self, **kwargs):
Examples
--------
>>> from skspatial.objects import Vector
>>> Vector([0, 0]).is_zero()
True
>>> Vector([1, 0]).is_zero()
Expand Down Expand Up @@ -251,6 +257,8 @@ def is_perpendicular(self, other, **kwargs):
Examples
--------
>>> from skspatial.objects import Vector
>>> Vector([0, 1]).is_perpendicular(Vector([1, 0]))
True
Expand Down Expand Up @@ -289,6 +297,8 @@ def is_parallel(self, other, **kwargs):
Examples
--------
>>> from skspatial.objects import Vector
>>> Vector([0, 1]).is_parallel(Vector([1, 0]))
False
Expand Down Expand Up @@ -328,6 +338,9 @@ def angle_between(self, other):
Examples
--------
>>> import numpy as np
>>> from skspatial.objects import Vector
>>> Vector([1, 0]).angle_between(Vector([1, 0]))
0.0
Expand Down Expand Up @@ -369,6 +382,8 @@ def project_vector(self, other):
Examples
--------
>>> from skspatial.objects import Vector
>>> Vector([0, 1]).project_vector(Vector([2, 1]))
Vector([0. 1. 0.])
Expand Down
6 changes: 6 additions & 0 deletions skspatial/objects/plane.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def from_points(cls, point_a, point_b, point_c):
Examples
--------
>>> from skspatial.objects import Point, Plane
>>> Plane.from_points(Point([0, 0]), Point([1, 0]), Point([3, 3]))
Plane(point=Point([0. 0. 0.]), normal=Vector([0. 0. 1.]))
Expand Down Expand Up @@ -93,6 +95,8 @@ def project_point(self, point):
Examples
--------
>>> from skspatial.objects import Point, Vector, Plane
>>> point = Point([10, 2, 5])
>>> plane = Plane(Point([0, 0, 0]), Vector([0, 0, 1]))
Expand Down Expand Up @@ -135,6 +139,8 @@ def distance_point_signed(self, point):
Examples
--------
>>> from skspatial.objects import Point, Vector, Plane
>>> plane = Plane(Point([0, 0]), Vector([0, 0, 1]))
>>> plane.distance_point_signed(Point([5, 2]))
Expand Down

0 comments on commit bc9aa3f

Please sign in to comment.