Skip to content

Add unit tests for LanguageDetectionFilter#1

Merged
kris927b merged 2 commits into
mainfrom
feat/language-filter-tests
Jun 4, 2025
Merged

Add unit tests for LanguageDetectionFilter#1
kris927b merged 2 commits into
mainfrom
feat/language-filter-tests

Conversation

@kris927b

@kris927b kris927b commented Jun 4, 2025

Copy link
Copy Markdown
Owner

This commit introduces a suite of unit tests for the LanguageDetectionFilter in src/pipeline/filters/language_filter.rs.

The following test cases have been added:

  • test_allowed_language: Tests processing of a document in an allowed language.
  • test_disallowed_language: Tests filtering of a document in a disallowed language.
  • test_low_confidence: Tests filtering of a document when language detection confidence is below the threshold.
  • test_confident_but_disallowed_language: Tests filtering when a language is detected with high confidence but is not in the allowed list.
  • test_allowed_language_low_confidence: Tests filtering when an allowed language is detected but with confidence below the threshold.

NOTE: Due to limitations in my current environment (Rust 1.75.0), I couldn't run the tests successfully. A transitive dependency (calendrical_calculations v0.1.3) requires Rust 1.81 or newer. My attempts to downgrade dependencies were unsuccessful in resolving this core incompatibility. I believe the tests are correct and should pass in an environment with an up-to-date Rust toolchain.

google-labs-jules Bot and others added 2 commits June 4, 2025 17:46
This commit introduces a suite of unit tests for the `LanguageDetectionFilter`
in `src/pipeline/filters/language_filter.rs`.

The following test cases have been added:
- `test_allowed_language`: Tests processing of a document in an allowed language.
- `test_disallowed_language`: Tests filtering of a document in a disallowed language.
- `test_low_confidence`: Tests filtering of a document when language detection confidence is below the threshold.
- `test_confident_but_disallowed_language`: Tests filtering when a language is detected with high confidence but is not in the allowed list.
- `test_allowed_language_low_confidence`: Tests filtering when an allowed language is detected but with confidence below the threshold.

NOTE: Due to limitations in my current environment (Rust 1.75.0), I couldn't run the tests successfully. A transitive dependency (`calendrical_calculations v0.1.3`) requires Rust 1.81 or newer. My attempts to downgrade dependencies were unsuccessful in resolving this core incompatibility. I believe the tests are correct and should pass in an environment with an up-to-date Rust toolchain.
@kris927b kris927b merged commit e77c2d8 into main Jun 4, 2025
1 check passed
@kris927b kris927b deleted the feat/language-filter-tests branch June 13, 2025 17:24
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.

1 participant