-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add objects folder inside property tests
- Loading branch information
Andrew Hynes
committed
Mar 5, 2019
1 parent
c6df224
commit 256f64e
Showing
10 changed files
with
45 additions
and
17 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
tests/property/test_line.py → tests/property/objects/test_line.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import pytest | ||
from hypothesis import given | ||
|
||
from skspatial.objects import Plane | ||
from tests.property.strategies import st_point | ||
|
||
|
||
@given(st_point(), st_point(), st_point()) | ||
def test_from_points_failure(point_a, point_b, point_c): | ||
|
||
if point_a.is_collinear(point_b, point_c): | ||
with pytest.raises(Exception): | ||
Plane.from_points(point_a, point_b, point_c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from hypothesis import given | ||
|
||
from skspatial.objects import Line | ||
from tests.property.strategies import st_point | ||
|
||
|
||
@given(st_point(), st_point(), st_point()) | ||
def test_is_collinear(point_a, point_b, point_c): | ||
|
||
assert point_a.is_collinear(point_a, point_a) | ||
assert point_a.is_collinear(point_a, point_b) | ||
|
||
all_different = not (point_a.is_close(point_b) or point_b.is_close(point_c)) | ||
|
||
if point_a.is_collinear(point_b, point_c) and all_different: | ||
|
||
line_ab = Line.from_points(point_a, point_b) | ||
line_bc = Line.from_points(point_b, point_c) | ||
|
||
assert line_ab.contains_point(point_c) | ||
assert line_bc.contains_point(point_a) | ||
|
||
assert line_ab.is_coplanar(line_bc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.