Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update groupname generation in classifications to handle English Longbow as a synonym for Longbow. #99

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions archeryutils/classifications/classification_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ def get_groupname(bowstyle: str, gender: str, age_group: str) -> str:
groupname : str
single, lower case str id for this category
"""
# Guard against English Longbow as a synonym for Longbow
if bowstyle.lower() == "english longbow":
bowstyle = "longbow"

groupname = (
f"{age_group.lower().replace(' ', '')}_"
f"{gender.lower()}_"
Expand Down
12 changes: 12 additions & 0 deletions archeryutils/classifications/tests/test_agb_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ def test_agb_field_classification_scores_genders(
"longbow",
[201, 188, 171, 155, 137, 121],
),
(
"wa_field_24_blue_marked",
"english longbow",
[201, 188, 171, 155, 137, 121],
),
],
)
def test_agb_field_classification_scores_bowstyles(
Expand Down Expand Up @@ -261,6 +266,13 @@ class TestCalculateAgbFieldClassification:
"longbow",
"unclassified",
),
(
"wa_field_24_blue_marked",
1,
"Under 12",
"english longbow",
"unclassified",
),
],
)
def test_calculate_agb_field_classification(
Expand Down
6 changes: 5 additions & 1 deletion archeryutils/classifications/tests/test_agb_indoor.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ def test_agb_indoor_classification_scores_genders(
"longbow",
[127, 178, 240, 306, 369, 423, 466, 501],
),
(
"english longbow",
[127, 178, 240, 306, 369, 423, 466, 501],
),
],
)
def test_agb_indoor_classification_scores_bowstyles(
Expand Down Expand Up @@ -333,7 +337,7 @@ class TestCalculateAgbIndoorClassification:
(
1,
"Under 12",
"longbow",
"english longbow",
"UC",
),
],
Expand Down
13 changes: 13 additions & 0 deletions archeryutils/classifications/tests/test_agb_outdoor.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ def test_agb_outdoor_classification_scores_genders(
"female",
[64, 94, 136, 195, 274, 373, 493, 625, 761],
),
(
"wa1440_70",
"english longbow",
"female",
[64, 94, 136, 195, 274, 373, 493, 625, 761],
),
],
)
def test_agb_outdoor_classification_scores_bowstyles(
Expand Down Expand Up @@ -386,6 +392,13 @@ class TestCalculateAgbOutdoorClassification:
"longbow",
"UC",
),
(
"metric_v",
250,
"Under 12",
"longbow",
"A1",
),
],
)
def test_calculate_agb_outdoor_classification(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ class TestStringUtils:

@pytest.mark.parametrize(
"bowstyle,age_group,gender,groupname_expected",
# Check all systems, different distances, negative and large handicaps.
[
("barebow", "adult", "male", "adult_male_barebow"),
("Barebow", "Adult", "Male", "adult_male_barebow"),
("Barebow", "Under 18", "Male", "under18_male_barebow"),
("RECURVE", "UnDeR 18", "femaLe", "under18_female_recurve"),
# Check English Longbow becomes Longbow
("English Longbow", "adult", "femaLe", "adult_female_longbow"),
],
)
def test_get_groupname(
Expand All @@ -36,7 +37,6 @@ def test_get_groupname(

@pytest.mark.parametrize(
"roundname,strippedname_expected",
# Check all systems, different distances, negative and large handicaps.
[
("portsmouth", "portsmouth"),
("portsmouth_triple", "portsmouth"),
Expand Down
Loading