re-structure

This commit is contained in:
Yaojia Wang
2026-02-01 22:55:31 +01:00
parent 400b12a967
commit b602d0a340
176 changed files with 856 additions and 853 deletions

View File

@@ -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,

View File

@@ -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")

View File

@@ -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: