Skip to content

Commit

Permalink
Add tests for invalid options to old indoor and update formatting of …
Browse files Browse the repository at this point in the history
…associated errors across all tests.
  • Loading branch information
jatkinson1000 committed Feb 22, 2025
1 parent d3ce2a9 commit e3315e4
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 20 deletions.
4 changes: 2 additions & 2 deletions archeryutils/classifications/agb_field_classifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def _get_field_groupname(
if bowstyle not in AGB_bowstyles or bowstyle not in field_bowstyles:
msg = (
f"{bowstyle} is not a recognised bowstyle for field classifications. "
f"Please select from {field_bowstyles}."
f"Please select from `{field_bowstyles}`."
)
raise ValueError(msg)
if gender not in AGB_genders:
Expand All @@ -98,7 +98,7 @@ def _get_field_groupname(
if age_group not in AGB_ages or age_group not in field_ages:
msg = (
f"{age_group} is not a recognised age group for field classifications. "
f"Please select from {field_ages}."
f"Please select from `{field_ages}`."
)
raise ValueError(msg)
return cls_funcs.get_groupname(bowstyle, gender, age_group)
Expand Down
2 changes: 1 addition & 1 deletion archeryutils/classifications/agb_indoor_classifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def _get_indoor_groupname(
if bowstyle not in AGB_bowstyles or bowstyle not in indoor_bowstyles:
msg = (
f"{bowstyle} is not a recognised bowstyle for indoor classifications. "
f"Please select from {indoor_bowstyles}."
f"Please select from `{indoor_bowstyles}`."
)
raise ValueError(msg)
if gender not in AGB_genders:
Expand Down
4 changes: 2 additions & 2 deletions archeryutils/classifications/agb_old_field_classifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def _get_old_field_groupname(
if bowstyle not in AGB_bowstyles or bowstyle not in old_field_bowstyles:
msg = (
f"{bowstyle} is not a recognised bowstyle for old field classifications. "
f"Please select from {old_field_bowstyles}."
f"Please select from `{old_field_bowstyles}`."
)
raise ValueError(msg)
if gender not in AGB_genders:
Expand All @@ -98,7 +98,7 @@ def _get_old_field_groupname(
if age_group not in AGB_ages or age_group not in old_field_ages:
msg = (
f"{age_group} is not a recognised age group for old field "
f"classifications. Please select from {old_field_ages}."
f"classifications. Please select from `{old_field_ages}`."
)
raise ValueError(msg)
return cls_funcs.get_groupname(bowstyle, gender, age_group)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _get_old_indoor_groupname(
if bowstyle not in AGB_bowstyles or bowstyle not in old_indoor_bowstyles:
msg = (
f"{bowstyle} is not a recognised bowstyle for old indoor classifications. "
f"Please select from {old_indoor_bowstyles}."
f"Please select from `{old_indoor_bowstyles}`."
)
raise ValueError(msg)
if gender not in AGB_genders:
Expand All @@ -69,7 +69,7 @@ def _get_old_indoor_groupname(
if age_group not in AGB_ages or age_group not in old_indoor_ages:
msg = (
f"{age_group} is not a recognised age group for old indoor "
f"classifications. Please select from {old_indoor_ages}."
f"classifications. Please select from `{old_indoor_ages}`."
)
raise ValueError(msg)
return cls_funcs.get_groupname(bowstyle, gender, age_group)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def _get_outdoor_groupname(
if bowstyle not in AGB_bowstyles or bowstyle not in outdoor_bowstyles:
msg = (
f"{bowstyle} is not a recognised bowstyle for outdoor classifications. "
f"Please select from {outdoor_bowstyles}."
f"Please select from `{outdoor_bowstyles}`."
)
raise ValueError(msg)
if gender not in AGB_genders:
Expand Down
8 changes: 4 additions & 4 deletions archeryutils/classifications/tests/test_agb_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ def test_agb_field_classification_scores_bowstyles(
(
"invalidbowstyle is not a recognised bowstyle for field "
"classifications. Please select from "
"AGB_bowstyles.COMPOUND|RECURVE|BAREBOW|ENGLISHLONGBOW|TRADITIONAL"
"|FLATBOW|COMPOUNDLIMITED|COMPOUNDBAREBOW."
"`AGB_bowstyles.COMPOUND|RECURVE|BAREBOW|ENGLISHLONGBOW|TRADITIONAL"
"|FLATBOW|COMPOUNDLIMITED|COMPOUNDBAREBOW`."
),
),
(
Expand All @@ -238,8 +238,8 @@ def test_agb_field_classification_scores_bowstyles(
(
"invalidage is not a recognised age group for field "
"classifications. Please select from "
"AGB_ages.AGE_50_PLUS|AGE_ADULT|AGE_UNDER_18|AGE_UNDER_16|"
"AGE_UNDER_15|AGE_UNDER_14|AGE_UNDER_12."
"`AGB_ages.AGE_50_PLUS|AGE_ADULT|AGE_UNDER_18|AGE_UNDER_16|"
"AGE_UNDER_15|AGE_UNDER_14|AGE_UNDER_12`."
),
),
],
Expand Down
2 changes: 1 addition & 1 deletion archeryutils/classifications/tests/test_agb_indoor.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def test_agb_indoor_classification_scores_triple_faces(
(
"invalidbowstyle is not a recognised bowstyle for indoor "
"classifications. Please select from "
"AGB_bowstyles.COMPOUND|RECURVE|BAREBOW|LONGBOW."
"`AGB_bowstyles.COMPOUND|RECURVE|BAREBOW|LONGBOW`."
),
),
(
Expand Down
6 changes: 3 additions & 3 deletions archeryutils/classifications/tests/test_agb_old_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ def test_agb_old_field_classification_scores_bowstyles(
(
"invalidbowstyle is not a recognised bowstyle for old field "
"classifications. Please select from "
"AGB_bowstyles.COMPOUND|RECURVE|BAREBOW|ENGLISHLONGBOW|TRADITIONAL"
"|FLATBOW|COMPOUNDLIMITED|COMPOUNDBAREBOW."
"`AGB_bowstyles.COMPOUND|RECURVE|BAREBOW|ENGLISHLONGBOW|TRADITIONAL"
"|FLATBOW|COMPOUNDLIMITED|COMPOUNDBAREBOW`."
),
),
(
Expand All @@ -223,7 +223,7 @@ def test_agb_old_field_classification_scores_bowstyles(
(
"invalidage is not a recognised age group for old field "
"classifications. "
"Please select from AGB_ages.AGE_ADULT|AGE_UNDER_18."
"Please select from `AGB_ages.AGE_ADULT|AGE_UNDER_18`."
),
),
],
Expand Down
24 changes: 21 additions & 3 deletions archeryutils/classifications/tests/test_agb_old_indoor.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,6 @@ def test_agb_old_indoor_classification_scores_gent_compound_worcester(
"bowstyle,gender,age_group,msg",
# Check all systems, different distances, negative and large handicaps.
[
# No invalid bowstyle as anything non-compound returns non-compound.
# No invalid age as only one table for all ages.
(
AGB_bowstyles.RECURVE,
"invalidgender",
Expand All @@ -160,6 +158,26 @@ def test_agb_old_indoor_classification_scores_gent_compound_worcester(
"classifications. Please select from `archeryutils.AGB_genders`."
),
),
(
AGB_bowstyles.BAREBOW,
AGB_genders.MALE,
AGB_ages.AGE_ADULT,
(
"AGB_bowstyles.BAREBOW is not a recognised bowstyle for old indoor "
"classifications. "
"Please select from `AGB_bowstyles.COMPOUND|RECURVE`."
),
),
(
AGB_bowstyles.RECURVE,
AGB_genders.MALE,
AGB_ages.AGE_UNDER_12,
(
"AGB_ages.AGE_UNDER_12 is not a recognised age group for "
"old indoor classifications. "
"Please select from `AGB_ages.AGE_ADULT`."
),
),
],
)
def test_agb_old_indoor_classification_scores_invalid(
Expand Down Expand Up @@ -279,7 +297,7 @@ def test_calculate_agb_old_indoor_classification_invalid_scores(
_ = class_funcs.calculate_agb_old_indoor_classification(
score=score,
roundname=roundname,
bowstyle=AGB_bowstyles.BAREBOW,
bowstyle=AGB_bowstyles.RECURVE,
gender=AGB_genders.MALE,
age_group=AGB_ages.AGE_ADULT,
)
2 changes: 1 addition & 1 deletion archeryutils/classifications/tests/test_agb_outdoor.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def test_agb_outdoor_classification_scores_small_faces(
(
"invalidbowstyle is not a recognised bowstyle for outdoor "
"classifications. Please select from "
"AGB_bowstyles.COMPOUND|RECURVE|BAREBOW|LONGBOW."
"`AGB_bowstyles.COMPOUND|RECURVE|BAREBOW|LONGBOW`."
),
),
(
Expand Down

0 comments on commit e3315e4

Please sign in to comment.