-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add xfailing tests for remaining bounds handlers
- Loading branch information
Showing
3 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
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,68 @@ | ||
""" | ||
Unit tests for Bounds.reflect method. | ||
""" | ||
|
||
import pytest | ||
|
||
|
||
@pytest.mark.xfail | ||
class TestBoundsReflect: | ||
""" | ||
Unit tests for Bounds.reflect method. | ||
""" | ||
|
||
def test_point_in_bounds(self, example_bounds, point_in_bounds): | ||
""" | ||
Test if reflection works as expected when the point lies within bounds. | ||
""" | ||
handled_point = example_bounds.reflect(point_in_bounds) | ||
assert handled_point.x == [14] | ||
|
||
def test_point_equal_lower_bound(self, example_bounds, point_equal_lower_bound): | ||
""" | ||
Test if reflection works as expected when the point lies on the lower bound. | ||
""" | ||
handled_point = example_bounds.reflect(point_equal_lower_bound) | ||
assert handled_point.x == [10] | ||
|
||
def test_point_equal_upper_bound(self, example_bounds, point_equal_upper_bound): | ||
""" | ||
Test if reflection works as expected when the point lies on the upper bound. | ||
""" | ||
handled_point = example_bounds.reflect(point_equal_upper_bound) | ||
assert handled_point.x == [20] | ||
|
||
def test_point_below_bounds(self, example_bounds, point_below_bounds): | ||
""" | ||
Test if reflection works as expected when the point lies below the lower bound. | ||
""" | ||
handled_point = example_bounds.reflect(point_below_bounds) | ||
assert handled_point.x == [18] | ||
|
||
def test_point_above_bounds(self, example_bounds, point_above_bounds): | ||
""" | ||
Test if reflection works as expected when the point lies above the upper bound. | ||
""" | ||
handled_point = example_bounds.reflect(point_above_bounds) | ||
assert handled_point.x == [17] | ||
|
||
def test_point_twice_below_bounds(self, example_bounds, point_twice_below_bounds): | ||
""" | ||
Test if reflection works as expected when the point lies far below the lower bound. | ||
""" | ||
handled_point = example_bounds.reflect(point_twice_below_bounds) | ||
assert handled_point.x == [16] | ||
|
||
def test_point_twice_above_bounds(self, example_bounds, point_twice_above_bounds): | ||
""" | ||
Test if reflection works as expected when the point lies far above the upper bound. | ||
""" | ||
handled_point = example_bounds.reflect(point_twice_above_bounds) | ||
assert handled_point.x == [12] | ||
|
||
def test_multidimensional(self, example_bounds, point_multidimensional): | ||
""" | ||
Test if reflection works as expected for a multidimensional point. | ||
""" | ||
handled_point = example_bounds.reflect(point_multidimensional) | ||
assert handled_point.x == [14, 10, 20, 18, 17, 16, 12] |
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,68 @@ | ||
""" | ||
Unit tests for Bounds.wrap method. | ||
""" | ||
|
||
import pytest | ||
|
||
|
||
@pytest.mark.xfail | ||
class TestBoundswrap: | ||
""" | ||
Unit tests for Bounds.wrap method. | ||
""" | ||
|
||
def test_point_in_bounds(self, example_bounds, point_in_bounds): | ||
""" | ||
Test if wrapping works as expected when the point lies within bounds. | ||
""" | ||
handled_point = example_bounds.wrap(point_in_bounds) | ||
assert handled_point.x == [14] | ||
|
||
def test_point_equal_lower_bound(self, example_bounds, point_equal_lower_bound): | ||
""" | ||
Test if wrapping works as expected when the point lies on the lower bound. | ||
""" | ||
handled_point = example_bounds.wrap(point_equal_lower_bound) | ||
assert handled_point.x == [10] | ||
|
||
def test_point_equal_upper_bound(self, example_bounds, point_equal_upper_bound): | ||
""" | ||
Test if wrapping works as expected when the point lies on the upper bound. | ||
""" | ||
handled_point = example_bounds.wrap(point_equal_upper_bound) | ||
assert handled_point.x == [20] | ||
|
||
def test_point_below_bounds(self, example_bounds, point_below_bounds): | ||
""" | ||
Test if wrapping works as expected when the point lies below the lower bound. | ||
""" | ||
handled_point = example_bounds.wrap(point_below_bounds) | ||
assert handled_point.x == [2] | ||
|
||
def test_point_above_bounds(self, example_bounds, point_above_bounds): | ||
""" | ||
Test if wrapping works as expected when the point lies above the upper bound. | ||
""" | ||
handled_point = example_bounds.wrap(point_above_bounds) | ||
assert handled_point.x == [14] | ||
|
||
def test_point_twice_below_bounds(self, example_bounds, point_twice_below_bounds): | ||
""" | ||
Test if wrapping works as expected when the point lies far below the lower bound. | ||
""" | ||
handled_point = example_bounds.wrap(point_twice_below_bounds) | ||
assert handled_point.x == [16] | ||
|
||
def test_point_twice_above_bounds(self, example_bounds, point_twice_above_bounds): | ||
""" | ||
Test if wrapping works as expected when the point lies far above the upper bound. | ||
""" | ||
handled_point = example_bounds.wrap(point_twice_above_bounds) | ||
assert handled_point.x == [12] | ||
|
||
def test_multidimensional(self, example_bounds, point_multidimensional): | ||
""" | ||
Test if wrapping works as expected for a multidimensional point. | ||
""" | ||
handled_point = example_bounds.wrap(point_multidimensional) | ||
assert handled_point.x == [14, 10, 20, 2, 14, 16, 12] |
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,29 @@ | ||
""" | ||
Unit tests for Bounds.handle_bounds method. | ||
""" | ||
|
||
import pytest | ||
|
||
|
||
class TestBoundsHandleBounds: | ||
""" | ||
Unit tests for Bounds.handle_bounds method. | ||
""" | ||
|
||
def test_project(self, example_bounds, point_multidimensional): | ||
handled_point = example_bounds.handle_bounds(point_multidimensional, "project") | ||
assert handled_point.x == [14, 10, 20, 10, 20, 10, 20] | ||
|
||
@pytest.mark.xfail() | ||
def test_reflect(self, example_bounds, point_multidimensional): | ||
handled_point = example_bounds.handle_bounds(point_multidimensional, "reflect") | ||
assert handled_point.x == [14, 10, 20, 18, 17, 16, 12] | ||
|
||
@pytest.mark.xfail() | ||
def test_wrap(self, example_bounds, point_multidimensional): | ||
handled_point = example_bounds.handle_bounds(point_multidimensional, "wrap") | ||
assert handled_point.x == [14, 10, 20, 2, 14, 16, 12] | ||
|
||
def test_invalid_mode(self, example_bounds, point_multidimensional): | ||
with pytest.raises(ValueError, match="Invalid mode"): | ||
example_bounds.handle_bounds(point_multidimensional, "invalid") |