Re-structure the project.

This commit is contained in:
Yaojia Wang
2026-01-25 15:21:11 +01:00
parent 8fd61ea928
commit e599424a92
80 changed files with 10672 additions and 1584 deletions

View File

@@ -0,0 +1,71 @@
"""
Tests for PlusgiroNormalizer
Usage:
pytest tests/normalize/normalizers/test_plusgiro_normalizer.py -v
"""
import pytest
from src.normalize.normalizers.plusgiro_normalizer import PlusgiroNormalizer
class TestPlusgiroNormalizer:
"""Test PlusgiroNormalizer functionality"""
@pytest.fixture
def normalizer(self):
"""Create normalizer instance for testing"""
return PlusgiroNormalizer()
def test_with_dash_8_digits(self, normalizer):
"""8-digit Plusgiro with dash should generate variants"""
result = normalizer.normalize('1234567-8')
assert '1234567-8' in result
assert '12345678' in result
def test_without_dash_8_digits(self, normalizer):
"""8-digit Plusgiro without dash should generate dash variant"""
result = normalizer.normalize('12345678')
assert '12345678' in result
assert '1234567-8' in result
def test_7_digits(self, normalizer):
"""7-digit Plusgiro should be handled"""
result = normalizer.normalize('1234567')
assert '1234567' in result
def test_empty_string(self, normalizer):
"""Empty string should return empty list"""
result = normalizer('')
assert result == []
def test_none_value(self, normalizer):
"""None value should return empty list"""
result = normalizer(None)
assert result == []
def test_callable_interface(self, normalizer):
"""Normalizer should be callable via __call__"""
result = normalizer('1234567-8')
assert '12345678' in result
def test_with_spaces(self, normalizer):
"""Plusgiro with spaces should be normalized"""
result = normalizer.normalize('1234567 8')
assert '12345678' in result
def test_9_digits(self, normalizer):
"""9-digit Plusgiro should be handled"""
result = normalizer.normalize('123456789')
assert '123456789' in result
def test_with_prefix(self, normalizer):
"""Plusgiro with PG: prefix should be normalized"""
result = normalizer.normalize('PG:1234567-8')
assert '12345678' in result
def test_generates_ocr_variants(self, normalizer):
"""Should generate OCR error variants"""
result = normalizer.normalize('1234567-8')
# Should contain multiple variants including OCR corrections
assert len(result) > 2