Skip to content

Commit

Permalink
Fixed linting issues and manual tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AKuederle committed Apr 19, 2024
1 parent c6c002e commit 64d0946
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
14 changes: 5 additions & 9 deletions gaitmap/trajectory_reconstruction/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
to make applying these methods to the default gaitmap datasets easier.
"""

from gaitmap.trajectory_reconstruction._region_level_trajectory import RegionLevelTrajectory
from gaitmap.trajectory_reconstruction._stride_level_trajectory import StrideLevelTrajectory
from gaitmap.trajectory_reconstruction.orientation_methods import MadgwickAHRS, SimpleGyroIntegration
from gaitmap.trajectory_reconstruction.position_methods._forward_backwards_integration import ForwardBackwardIntegration
from gaitmap.trajectory_reconstruction.trajectory_methods import MadgwickRtsKalman, RtsKalman
from gaitmap.utils._gaitmap_mad import patch_gaitmap_mad_import

_gaitmap_mad_modules = {
Expand All @@ -14,15 +19,6 @@
del __getattr__
from gaitmap_mad.trajectory_reconstruction.position_methods import PieceWiseLinearDedriftedIntegration


from gaitmap.trajectory_reconstruction._region_level_trajectory import RegionLevelTrajectory
from gaitmap.trajectory_reconstruction._stride_level_trajectory import StrideLevelTrajectory
from gaitmap.trajectory_reconstruction.orientation_methods import MadgwickAHRS, SimpleGyroIntegration
from gaitmap.trajectory_reconstruction.position_methods import (
ForwardBackwardIntegration,
)
from gaitmap.trajectory_reconstruction.trajectory_methods import MadgwickRtsKalman, RtsKalman

__all__ = [
"MadgwickAHRS",
"SimpleGyroIntegration",
Expand Down
10 changes: 5 additions & 5 deletions tests/_test_gaitmap_mad_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def _gaitmap_mad_sys_modifier():

sys.modules["gaitmap_mad"] = None
yield
sys.modules.pop("gaitmap_mad")
sys.modules.pop("gaitmap_mad", None)
import gaitmap_mad # noqa: F401, F811

# We just go overboard to be save and reimport all gaitmap modules after the cleanup.
Expand All @@ -40,13 +40,12 @@ def _gaitmap_mad_sys_modifier():

@pytest.fixture(scope="module")
def _gaitmap_mad_change_version():
sys.modules.pop("gaitmap_mad", None)
import gaitmap_mad

real_version = gaitmap_mad.__version__
gaitmap_mad.__version__ = "0.0.0"
yield
gaitmap_mad.__version__ = real_version
importlib.reload(gaitmap_mad)
sys.modules.pop("gaitmap_mad")


def test_raises_error_gaitmap_mad_not_installed(_gaitmap_mad_sys_modifier) -> None:
Expand All @@ -73,12 +72,13 @@ def test_error_not_raised_when_importing_ori_methods(_gaitmap_mad_sys_modifier)
def test_gaitmap_mad_version_mismatch(_gaitmap_mad_change_version) -> None:
# We need to make sure that this is a fresh import:
sys.modules.pop("gaitmap.stride_segmentation", None)
with pytest.raises(AssertionError):
with pytest.raises(ImportError):
from gaitmap.stride_segmentation import BarthDtw # noqa: F401


def test_raises_no_error_gaitmap_mad_installed() -> None:
# We need to make sure that this is a fresh import:
sys.modules.pop("gaitmap_mad", None)
sys.modules.pop("gaitmap.stride_segmentation", None)
from gaitmap.stride_segmentation import BarthDtw # noqa: F401

Expand Down

0 comments on commit 64d0946

Please sign in to comment.