Skip to content

Fix test_classification.py to reflect current classification.py#279

Merged
tkswanson merged 1 commit into
detect_include_categoriesfrom
copilot/update-test-classification
May 1, 2026
Merged

Fix test_classification.py to reflect current classification.py#279
tkswanson merged 1 commit into
detect_include_categoriesfrom
copilot/update-test-classification

Conversation

Copy link
Copy Markdown

Copilot AI commented May 1, 2026

test_classification.py had three mismatches with the actual classification.py implementation that caused import errors and incorrect test assertions.

Changes

  • Remove stale importfrom animl.split import get_animals references a module that no longer exists. Replaced the single usage with inline filtering: detections[detections["category_label"] == "animal"].reset_index(drop=True)

  • Fix test_non_dataframe_detections_raises — used "not_a_dataframe" (a str), which classify() accepts as a single file path, so no error was raised at input validation. Changed to a dict input to actually hit the unhandled-type branch. Updated expected exception from ValueError to AssertionError to match the raise AssertionError("Input must be a data frame of crops, single file path or vector of file paths.") in the code.

  • Fix test_empty_animals_with_empty_detectionssingle_classification reads empty['category_label'] to populate prediction; the test's empty DataFrame was missing this column. Replaced the pre-built prediction/confidence columns with category_label.

@tkswanson tkswanson marked this pull request as ready for review May 1, 2026 21:20
@tkswanson tkswanson merged commit 9f46fa6 into detect_include_categories May 1, 2026
@tkswanson tkswanson deleted the copilot/update-test-classification branch May 1, 2026 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants