re-structure
This commit is contained in:
@@ -11,8 +11,8 @@ Tests field normalization functions:
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from inference.pipeline.field_extractor import FieldExtractor
|
||||
from inference.pipeline.normalizers import (
|
||||
from backend.pipeline.field_extractor import FieldExtractor
|
||||
from backend.pipeline.normalizers import (
|
||||
InvoiceNumberNormalizer,
|
||||
OcrNumberNormalizer,
|
||||
BankgiroNormalizer,
|
||||
|
||||
@@ -8,7 +8,7 @@ matching variants from known values.
|
||||
|
||||
from unittest.mock import patch
|
||||
import pytest
|
||||
from inference.pipeline.normalizers import (
|
||||
from backend.pipeline.normalizers import (
|
||||
NormalizationResult,
|
||||
InvoiceNumberNormalizer,
|
||||
OcrNumberNormalizer,
|
||||
@@ -490,7 +490,7 @@ class TestEnhancedAmountNormalizer:
|
||||
# Need input that bypasses labeled patterns AND shared validator
|
||||
# but has decimal pattern matches
|
||||
with patch(
|
||||
"inference.pipeline.normalizers.amount.FieldValidators.parse_amount",
|
||||
"backend.pipeline.normalizers.amount.FieldValidators.parse_amount",
|
||||
return_value=None,
|
||||
):
|
||||
result = normalizer.normalize("Items: 100,00 and 200,00 and 300,00")
|
||||
@@ -560,7 +560,7 @@ class TestDateNormalizer:
|
||||
def test_fallback_pattern_with_mock(self, normalizer):
|
||||
"""Test fallback PATTERNS when shared validator returns None (line 83)."""
|
||||
with patch(
|
||||
"inference.pipeline.normalizers.date.FieldValidators.format_date_iso",
|
||||
"backend.pipeline.normalizers.date.FieldValidators.format_date_iso",
|
||||
return_value=None,
|
||||
):
|
||||
result = normalizer.normalize("2025-08-29")
|
||||
@@ -667,7 +667,7 @@ class TestEnhancedDateNormalizer:
|
||||
def test_swedish_pattern_fallback_with_mock(self, normalizer):
|
||||
"""Test Swedish pattern when shared validator returns None (line 170)."""
|
||||
with patch(
|
||||
"inference.pipeline.normalizers.date.FieldValidators.format_date_iso",
|
||||
"backend.pipeline.normalizers.date.FieldValidators.format_date_iso",
|
||||
return_value=None,
|
||||
):
|
||||
result = normalizer.normalize("15 maj 2025")
|
||||
@@ -677,7 +677,7 @@ class TestEnhancedDateNormalizer:
|
||||
def test_ymd_compact_fallback_with_mock(self, normalizer):
|
||||
"""Test ymd_compact pattern when shared validator returns None (lines 187-192)."""
|
||||
with patch(
|
||||
"inference.pipeline.normalizers.date.FieldValidators.format_date_iso",
|
||||
"backend.pipeline.normalizers.date.FieldValidators.format_date_iso",
|
||||
return_value=None,
|
||||
):
|
||||
result = normalizer.normalize("20250315")
|
||||
|
||||
@@ -10,7 +10,7 @@ Tests the cross-validation logic between payment_line and detected fields:
|
||||
|
||||
import pytest
|
||||
from unittest.mock import MagicMock, patch
|
||||
from inference.pipeline.pipeline import InferencePipeline, InferenceResult, CrossValidationResult
|
||||
from backend.pipeline.pipeline import InferencePipeline, InferenceResult, CrossValidationResult
|
||||
|
||||
|
||||
class TestCrossValidationResult:
|
||||
|
||||
Reference in New Issue
Block a user