Skip to content

Commit

Permalink
fix: typing
Browse files Browse the repository at this point in the history
  • Loading branch information
engnadeau committed Aug 23, 2022
1 parent 9b1fecd commit e346bd3
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,46 @@
"""Pytest config."""
from pathlib import Path
from typing import Dict, List, Union

import numpy as np
import numpy.typing as npt
from pytest import fixture

from pybotics.kinematic_chain import MDHKinematicChain
from pybotics.robot import Robot


@fixture()
def planar_robot():
def planar_robot() -> Robot:
"""Generate planar robot."""
return Robot(
MDHKinematicChain(np.array([[0, 0, 0, 0], [0, 10, 0, 0], [0, 20, 0, 0]]))
MDHKinematicChain.from_parameters(
np.array([[0, 0, 0, 0], [0, 10, 0, 0], [0, 20, 0, 0]])
)
)


@fixture()
def resources_path():
def resources_path() -> Path:
"""Get resources path."""
return (Path(__file__).parent / "resources").resolve()


@fixture()
def vector_transforms(resources_path: Path):
def vector_transforms(
resources_path: Path,
) -> List[Dict[str, Union[npt.NDArray[np.float64], str]]]:
"""Get resource data."""
data = np.genfromtxt(
fname=resources_path / "vector-transforms.csv", delimiter=",", dtype=str
)
return [
) # type: ignore

result = [
{
"vector": d[:6].astype(float),
"transform": d[6:-1].astype(float),
"order": d[-1],
}
for d in data
]
return result

0 comments on commit e346bd3

Please sign in to comment.