Skip to content

Commit

Permalink
fix: "-> None" if function does not return a value
Browse files Browse the repository at this point in the history
  • Loading branch information
engnadeau committed Aug 23, 2022
1 parent f5ac85a commit f6be0e2
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion examples/basic_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pybotics.tool import Tool


def main():
def main() -> None:
"""
Demonstrate pybotics usage.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pybotics.errors import PyboticsError


def test_errors():
def test_errors() -> None:
"""
Test error.
Expand Down
12 changes: 6 additions & 6 deletions tests/test_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


@given(st.floats(allow_nan=False, allow_infinity=False))
def test_wrap_2_pi(angle):
def test_wrap_2_pi(angle) -> None:
"""
Test angle wrapping.
Expand Down Expand Up @@ -45,7 +45,7 @@ def test_wrap_2_pi(angle):

@given(angle=st.floats(allow_nan=False, allow_infinity=False))
@settings(deadline=None)
def test_rotation_matrix_xyz(angle, resources_path: Path):
def test_rotation_matrix_xyz(angle, resources_path: Path) -> None:
"""Test."""
# define functions to test
rotation_functions = {
Expand Down Expand Up @@ -101,7 +101,7 @@ def test_rotation_matrix_xyz(angle, resources_path: Path):
elements=st.floats(allow_nan=False, allow_infinity=False),
)
)
def test_translation_matrix(xyz):
def test_translation_matrix(xyz) -> None:
"""Test."""
matrix = pybotics.geometry.translation_matrix(xyz)

Expand All @@ -127,7 +127,7 @@ def test_translation_matrix(xyz):
pybotics.geometry.translation_matrix(np.zeros(10))


def test_vector_2_matrix(vector_transforms: Sequence[dict]):
def test_vector_2_matrix(vector_transforms: Sequence[dict]) -> None:
"""Test."""
# test regular usage
for d in vector_transforms:
Expand All @@ -142,7 +142,7 @@ def test_vector_2_matrix(vector_transforms: Sequence[dict]):
pybotics.geometry.vector_2_matrix(d["vector"], convention="foobar")


def test_matrix_2_vector(vector_transforms: Sequence[dict]):
def test_matrix_2_vector(vector_transforms: Sequence[dict]) -> None:
"""Test."""
for d in vector_transforms:
for c in [
Expand All @@ -161,7 +161,7 @@ def test_matrix_2_vector(vector_transforms: Sequence[dict]):
)


def test_orientation():
def test_orientation() -> None:
"""Test."""
# ensure order and name match
for e in list(OrientationConvention.__members__.values()):
Expand Down
14 changes: 7 additions & 7 deletions tests/test_kinematic_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from pybotics.link import MDHLink, RevoluteMDHLink


def test_init():
def test_init() -> None:
"""Test."""
# test error
with raises(PyboticsError):
Expand All @@ -17,42 +17,42 @@ def test_init():
MDHKinematicChain([RevoluteMDHLink()])


def test_num_parameters():
def test_num_parameters() -> None:
"""Test."""
link = RevoluteMDHLink()
kc = MDHKinematicChain([link])
assert kc.num_parameters == MDHLink._size


def test_vector():
def test_vector() -> None:
"""Test."""
link = RevoluteMDHLink()
kc = MDHKinematicChain([link])
np.testing.assert_allclose(kc.vector, link.vector)


def test_repr():
def test_repr() -> None:
"""Test."""
link = RevoluteMDHLink()
kc = MDHKinematicChain([link])
repr(kc)


def test_to_json():
def test_to_json() -> None:
"""Test."""
link = RevoluteMDHLink()
kc = MDHKinematicChain([link])
kc.to_json()


def test_links_setter():
def test_links_setter() -> None:
"""Test."""
link = RevoluteMDHLink()
kc = MDHKinematicChain([link])
kc.links = link


def test_ndof():
def test_ndof() -> None:
"""Test."""
link = RevoluteMDHLink()
kc = MDHKinematicChain([link])
Expand Down
8 changes: 4 additions & 4 deletions tests/test_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@
from pybotics.link import PrismaticMDHLink, RevoluteMDHLink


def test_len():
def test_len() -> None:
"""Test."""
assert len(RevoluteMDHLink()) == 4


def test_displace():
def test_displace() -> None:
"""Test."""
link = PrismaticMDHLink()
np.testing.assert_allclose(link.displace(), link.vector)


def test_repr():
def test_repr() -> None:
"""Test."""
link = RevoluteMDHLink()
repr(link)


def test_json():
def test_json() -> None:
"""Test."""
link = RevoluteMDHLink()
link.to_json()
6 changes: 3 additions & 3 deletions tests/test_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
elements=st.floats(allow_nan=False, allow_infinity=False),
)
)
def test_compute_absolute_errors(q: np.ndarray):
def test_compute_absolute_errors(q: np.ndarray) -> None:
"""Test."""
robot = Robot.from_parameters(ur10())
pose = robot.fk(q)
Expand Down Expand Up @@ -58,7 +58,7 @@ def test_compute_absolute_errors(q: np.ndarray):
elements=st.floats(allow_nan=False, allow_infinity=False),
),
)
def test_compute_relative_errors(q_a: np.ndarray, q_b: np.ndarray):
def test_compute_relative_errors(q_a: np.ndarray, q_b: np.ndarray) -> None:
"""Test."""
robot = Robot.from_parameters(ur10())

Expand All @@ -82,7 +82,7 @@ def test_compute_relative_errors(q_a: np.ndarray, q_b: np.ndarray):
np.testing.assert_allclose(actual_error, 0) # type: ignore


def test_optimization():
def test_optimization() -> None:
"""Test."""
# init robot model and error wrt nominal
actual_robot = Robot.from_parameters(ur10())
Expand Down
2 changes: 1 addition & 1 deletion tests/test_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pybotics.tool import Tool


def test_tool():
def test_tool() -> None:
"""Test."""
tool = Tool()

Expand Down

0 comments on commit f6be0e2

Please sign in to comment.