Skip to content

Commit eb69d2d

Browse files
committed
update tests to pass
1 parent 0f24c3f commit eb69d2d

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

lib/idp_common_pkg/idp_common/config/models.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,6 @@ def parse_int(cls, v: Any) -> int:
132132
return int(v) if v else 0
133133
return int(v)
134134

135-
@model_validator(mode="after")
136-
def model_validator(self) -> Self:
137-
if not self.agentic.review_agent_model:
138-
self.agentic.review_agent_model = self.model
139-
140-
return self
141-
142135
@model_validator(mode="after")
143136
def set_default_review_agent_model(self) -> Self:
144137
"""Set review_agent_model to extraction model if not specified."""

lib/idp_common_pkg/tests/unit/classification/test_classification_service.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,8 @@ def test_classify_page_bedrock_success(
291291

292292
# Verify calls
293293
mock_get_text.assert_called_once_with("s3://bucket/text.txt")
294-
mock_prepare_image.assert_called_once_with("s3://bucket/image.jpg", None, None)
294+
# ImageConfig defaults to 1200x1200 when not explicitly configured
295+
mock_prepare_image.assert_called_once_with("s3://bucket/image.jpg", 1200, 1200)
295296
mock_prepare_bedrock_image.assert_called_once_with(b"image_data")
296297
mock_invoke.assert_called_once()
297298

lib/idp_common_pkg/tests/unit/ocr/test_ocr_service.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ def test_init_textract_backend_default(self):
106106
assert service.max_workers == 20
107107
assert service.dpi is None # Default is None
108108
assert service.enhanced_features is False
109-
# Default image sizing
109+
# Default image sizing (from ImageConfig defaults)
110110
assert service.resize_config == {
111-
"target_width": 951,
112-
"target_height": 1268,
111+
"target_width": 1200,
112+
"target_height": 1200,
113113
}
114114
assert service.preprocessing_config is None
115115

@@ -198,10 +198,10 @@ def test_init_config_pattern_default_sizing(self):
198198
with patch("boto3.client"):
199199
service = OcrService(config=config)
200200

201-
# Verify defaults are applied
201+
# Verify defaults are applied (from ImageConfig model defaults)
202202
assert service.resize_config == {
203-
"target_width": 951,
204-
"target_height": 1268,
203+
"target_width": 1200,
204+
"target_height": 1200,
205205
}
206206
assert service.dpi == 200
207207

@@ -242,30 +242,34 @@ def test_init_config_pattern_empty_strings_apply_defaults(self):
242242
with patch("boto3.client"):
243243
service = OcrService(config=config)
244244

245-
# Verify defaults are applied (empty strings treated same as None)
245+
# Verify OCR service defaults are applied (empty strings treated same as None)
246+
# Note: Empty strings bypass Pydantic defaults, triggering OCR service defaults
246247
assert service.resize_config == {
247248
"target_width": 951,
248249
"target_height": 1268,
249250
}
250251
assert service.dpi == 150
251252

252253
def test_init_config_pattern_partial_sizing(self):
253-
"""Test initialization with partial sizing configuration preserves existing behavior."""
254+
"""Test initialization with partial sizing configuration uses explicit width and default height."""
254255
config = {
255256
"ocr": {
256257
"image": {
257258
"dpi": 150,
258259
"target_width": 800,
259-
# target_height missing - should disable defaults
260+
# target_height missing - Pydantic model provides default of 1200
260261
}
261262
}
262263
}
263264

264265
with patch("boto3.client"):
265266
service = OcrService(config=config)
266267

267-
# Verify partial config disables defaults
268-
assert service.resize_config is None
268+
# Verify explicit width is used with default height from ImageConfig model
269+
assert service.resize_config == {
270+
"target_width": 800,
271+
"target_height": 1200,
272+
}
269273
assert service.dpi == 150
270274

271275
def test_init_config_pattern_invalid_sizing_fallback(self):

0 commit comments

Comments
 (0)