Skip to content

feat: Add helper function unit tests#75

Merged
RafaelCenzano merged 5 commits into
mainfrom
add-helper-unit-tests
Apr 17, 2026
Merged

feat: Add helper function unit tests#75
RafaelCenzano merged 5 commits into
mainfrom
add-helper-unit-tests

Conversation

@RafaelCenzano

Copy link
Copy Markdown
Member

Description

Add test suite for helper functions

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds/extends unit test coverage for several helper modules and provides a Makefile target to run the test suite.

Changes:

  • Expanded sanitize and description_search helper tests (including private helper coverage).
  • Added new unit test modules for auth, db, and cache helpers.
  • Added a make test target; minor import ordering adjustment in server/models/laf.py.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_sanitize.py Adds tests for whitespace normalization and key rejection logic.
tests/test_description_search.py Adds tests for token scoring and prefilter alternate expansion.
tests/test_db.py New tests for async iteration, date delta formatting, and sequence generation behavior.
tests/test_cache.py New tests for request-stripping cache key generation.
tests/test_auth.py New tests for token validation, token creation expiry behavior, and auth helpers.
server/models/laf.py Minor import reordering.
Makefile Adds test target to run pytest via uv.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_description_search.py Outdated
Comment on lines +83 to +86
def test_token_match_score_averages_best_ratios() -> None:
"""Single query token: score equals best fuzzy ratio against text tokens."""
score = token_match_score(["cat"], ["bat", "car"])
assert 0.0 < score <= 100.0

Copilot AI Apr 17, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test name/docstring claims it validates that token_match_score averages the best fuzzy ratios, but the assertion only checks the return is within (0, 100], which would pass even if the function returned a constant (e.g. always 1.0). Consider asserting against a concrete expected value (e.g., compute expected = max(fuzz.ratio('cat', t) for t in ['bat','car']) and compare with pytest.approx(expected)), and/or add a multi-token case to actually exercise the averaging behavior.

Copilot uses AI. Check for mistakes.
@RafaelCenzano RafaelCenzano merged commit 244c255 into main Apr 17, 2026
6 checks passed
@RafaelCenzano RafaelCenzano deleted the add-helper-unit-tests branch April 17, 2026 07:31
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