Skip to content

Commit

Permalink
Update typing and close assertions in tests as suggested by @LiamPatt…
Browse files Browse the repository at this point in the history
  • Loading branch information
jatkinson1000 committed Jul 15, 2024
1 parent 1bfbd16 commit 29fce01
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions archeryutils/classifications/agb_outdoor_classifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
agb_outdoor_classification_scores
"""

from typing import Any, Literal, Optional, TypedDict, cast
from typing import Any, Literal, TypedDict, cast

import numpy as np
import numpy.typing as npt
Expand Down Expand Up @@ -575,7 +575,7 @@ def agb_outdoor_classification_fraction( # noqa: PLR0913 Too many arguments
bowstyle: str,
gender: str,
age_group: str,
restrict: Optional[bool] = True,
restrict: bool | None = True,
) -> float:
"""
Calculate the fraction towards the next classification an archer is.
Expand Down
16 changes: 8 additions & 8 deletions archeryutils/classifications/tests/test_agb_indoor.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_agb_indoor_classification_scores_ages(
age_group=age_group,
)

assert scores == scores_expected[::-1]
assert scores == pytest.approx(scores_expected[::-1])

@pytest.mark.parametrize(
"age_group,scores_expected",
Expand Down Expand Up @@ -128,7 +128,7 @@ def test_agb_indoor_classification_scores_genders(
age_group=age_group,
)

assert scores == scores_expected[::-1]
assert scores == pytest.approx(scores_expected[::-1])

@pytest.mark.parametrize(
"bowstyle,scores_expected",
Expand Down Expand Up @@ -160,7 +160,7 @@ def test_agb_indoor_classification_scores_bowstyles(
age_group="adult",
)

assert scores == scores_expected[::-1]
assert scores == pytest.approx(scores_expected[::-1])

@pytest.mark.parametrize(
"bowstyle,scores_expected",
Expand Down Expand Up @@ -192,7 +192,7 @@ def test_agb_indoor_classification_scores_nonbowstyles(
age_group="adult",
)

assert scores == scores_expected[::-1]
assert scores == pytest.approx(scores_expected[::-1])

@pytest.mark.parametrize(
"roundname,scores_expected",
Expand Down Expand Up @@ -228,7 +228,7 @@ def test_agb_indoor_classification_scores_triple_faces(
age_group="adult",
)

assert scores == scores_expected[::-1]
assert scores == pytest.approx(scores_expected[::-1])

@pytest.mark.parametrize(
"roundname,bowstyle,gender,age_group",
Expand Down Expand Up @@ -469,7 +469,7 @@ def test_agb_indoor_classification_fraction( # noqa: PLR0913 Too many arguments
age_group=age_group,
)

assert frac_returned == frac_expected
assert frac_returned == pytest.approx(frac_expected)

@pytest.mark.parametrize(
"roundname,score,age_group,bowstyle,frac_expected",
Expand Down Expand Up @@ -521,7 +521,7 @@ def test_agb_indoor_classification_fraction_low( # noqa: PLR0913 many args
age_group=age_group,
)

assert frac_returned == frac_expected
assert frac_returned == pytest.approx(frac_expected)

@pytest.mark.parametrize(
"roundname,score,age_group,bowstyle,frac_expected",
Expand Down Expand Up @@ -573,4 +573,4 @@ def test_agb_indoor_classification_fraction_high( # noqa: PLR0913 Too many args
age_group=age_group,
)

assert frac_returned == frac_expected
assert frac_returned == pytest.approx(frac_expected)
18 changes: 9 additions & 9 deletions archeryutils/classifications/tests/test_agb_outdoor.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def test_agb_outdoor_classification_scores_ages(
age_group=age_group,
)

assert scores == scores_expected[::-1]
assert scores == pytest.approx(scores_expected[::-1])

@pytest.mark.parametrize(
"roundname,age_group,scores_expected",
Expand Down Expand Up @@ -143,7 +143,7 @@ def test_agb_outdoor_classification_scores_genders(
age_group=age_group,
)

assert scores == scores_expected[::-1]
assert scores == pytest.approx(scores_expected[::-1])

@pytest.mark.parametrize(
"roundname,bowstyle,gender,scores_expected",
Expand Down Expand Up @@ -201,7 +201,7 @@ def test_agb_outdoor_classification_scores_bowstyles(
age_group="adult",
)

assert scores == scores_expected[::-1]
assert scores == pytest.approx(scores_expected[::-1])

@pytest.mark.parametrize(
"roundname,bowstyle,gender,scores_expected",
Expand Down Expand Up @@ -241,7 +241,7 @@ def test_agb_outdoor_classification_scores_nonbowstyles(
age_group="adult",
)

assert scores == scores_expected[::-1]
assert scores == pytest.approx(scores_expected[::-1])

@pytest.mark.parametrize(
"roundname,scores_expected",
Expand Down Expand Up @@ -269,7 +269,7 @@ def test_agb_outdoor_classification_scores_triple_faces(
age_group="adult",
)

assert scores == scores_expected[::-1]
assert scores == pytest.approx(scores_expected[::-1])

@pytest.mark.parametrize(
"roundname,bowstyle,gender,age_group",
Expand Down Expand Up @@ -621,7 +621,7 @@ def test_agb_outdoor_classification_fraction( # noqa: PLR0913 many args
age_group=age_group,
)

assert frac_returned == frac_expected
assert frac_returned == pytest.approx(frac_expected)

@pytest.mark.parametrize(
"roundname,score,age_group,bowstyle,frac_expected",
Expand Down Expand Up @@ -673,7 +673,7 @@ def test_agb_outdoor_classification_fraction_low( # noqa: PLR0913 many args
age_group=age_group,
)

assert frac_returned == frac_expected
assert frac_returned == pytest.approx(frac_expected)

@pytest.mark.parametrize(
"roundname,score,age_group,bowstyle,frac_expected",
Expand Down Expand Up @@ -725,7 +725,7 @@ def test_agb_outdoor_classification_fraction_high( # noqa: PLR0913 many args
age_group=age_group,
)

assert frac_returned == frac_expected
assert frac_returned == pytest.approx(frac_expected)

def test_agb_outdoor_classification_fraction_restrict(
self,
Expand All @@ -749,4 +749,4 @@ def test_agb_outdoor_classification_fraction_restrict(
restrict=False,
)

assert frac_unrestricted == 0.4541258975704667
assert frac_unrestricted == pytest.approx(0.4541258975704667)

0 comments on commit 29fce01

Please sign in to comment.