Removed the subdir.
This commit is contained in:
44
pyrate/tests/plan/geometry/primitives/test_common.py
Normal file
44
pyrate/tests/plan/geometry/primitives/test_common.py
Normal file
@ -0,0 +1,44 @@
|
||||
"""Tests some general properties of geometries."""
|
||||
|
||||
# Generic testing
|
||||
from unittest import TestCase
|
||||
|
||||
# Scientific testing
|
||||
from numpy.testing import assert_array_almost_equal
|
||||
|
||||
# Hypothesis testing
|
||||
from hypothesis import given
|
||||
import hypothesis.strategies as st
|
||||
|
||||
# Package under test
|
||||
from pyrate.plan.geometry import CartesianGeometry
|
||||
|
||||
# Test helpers
|
||||
from pyrate.common.testing.strategies.geometry import cartesian_objects
|
||||
from pyrate.common.testing.strategies.geometry import geo_bearings
|
||||
|
||||
|
||||
class TestCartesianGeometries(TestCase):
|
||||
"""Asserts general properties of the cartesian geometries."""
|
||||
|
||||
@given(
|
||||
cartesian_objects(),
|
||||
geo_bearings(),
|
||||
st.floats(min_value=1.0, max_value=100_000.0),
|
||||
)
|
||||
def test_translation_is_invertible(
|
||||
self,
|
||||
original: CartesianGeometry,
|
||||
direction: float,
|
||||
distance: float,
|
||||
) -> None:
|
||||
"""Tests that translation is invertible and a valid backwards vector is returned."""
|
||||
|
||||
# translate & translate back
|
||||
translated, back_vector = original.translate(direction, distance)
|
||||
back_direction = (direction + 180) % 360
|
||||
translated_translated, back_back_vector = translated.translate(back_direction, distance)
|
||||
|
||||
# check the result
|
||||
assert_array_almost_equal(back_vector, -back_back_vector, decimal=9)
|
||||
self.assertTrue(original.equals_exact(translated_translated, tolerance=1e-9))
|
Reference in New Issue
Block a user