Skip to content

tests: add unit tests for extraction validator review workflow#423

Open
Arijit429 wants to merge 8 commits intofireform-core:mainfrom
Arijit429:validator-test-coverage
Open

tests: add unit tests for extraction validator review workflow#423
Arijit429 wants to merge 8 commits intofireform-core:mainfrom
Arijit429:validator-test-coverage

Conversation

@Arijit429
Copy link
Copy Markdown

🚀 Summary

This PR adds dedicated unit tests for the extraction validation and review workflow to improve reliability and ensure consistent behavior across common edge cases.

The goal is to strengthen confidence in the validation pipeline introduced earlier by verifying expected behavior for complete, incomplete, null, and placeholder-based extraction outputs.


✨ What Changed

Added a new test file:

test/test_extraction_validator.py

This introduces focused unit tests for the ExtractionValidator class.


🧪 Test Coverage Added

1) Missing fields should require review

Validates that incomplete extraction outputs correctly trigger:

requires_review = True

and reduce the confidence score.


2) Complete fields should not require review

Ensures that fully populated structured outputs return:

requires_review = False

with full confidence.


3) Null field handling

Verifies that None values are correctly treated as missing data and routed for review.


4) Placeholder value handling

Tests edge cases where placeholder values such as:

"-1"

are returned by the extraction pipeline.

These should also trigger review.


💡 Why This Helps

This improves confidence in the validation workflow and ensures that downstream form filling logic receives consistently validated outputs.

This directly strengthens:

  • extraction reliability
  • review flag correctness
  • confidence scoring behavior
  • regression safety for future changes

🔍 Code-Level Focus

The tests primarily validate:

validator.validate(data)

and confirm the expected response structure:

{
    "requires_review": ...,
    "confidence_score": ...,
    "missing_fields": ...
}

🧪 Local Testing

Executed using:

PYTHONPATH=. pytest test/test_extraction_validator.py -q

and verified successful execution of all added test cases.


🎯 Impact

This PR improves maintainability and makes future validator enhancements safer by introducing a dedicated automated test layer.

@Arijit429
Copy link
Copy Markdown
Author

Added focused unit tests for the validator workflow and verified the core review scenarios locally — happy to extend coverage further based on feedback.

@Arijit429 Arijit429 force-pushed the validator-test-coverage branch from 70bd363 to 1544bbe Compare April 19, 2026 19:28
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