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