Skip to content

Commit bcf95ef

Browse files
committed
updated cache_ttl validation to only accept positive values
1 parent f59efe7 commit bcf95ef

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

extract_thinker/document_loader/document_loader_easy_ocr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ def __post_init__(self):
3030
"""Initialize EasyOCR reader with configuration settings and validation."""
3131
if not self.lang_list:
3232
raise ValueError("lang_list must contain at least one language code.")
33-
if self.cache_ttl < 0:
34-
raise ValueError("cache_ttl must be non-negative.")
33+
if self.cache_ttl <= 0:
34+
raise ValueError("cache_ttl must be positive.")
3535

3636
self.reader = easyocr.Reader(
3737
lang_list=self.lang_list,

tests/test_document_loader_easyocr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ def test_easyocr_config_validation(self):
9393
with pytest.raises(ValueError, match="lang_list must contain at least one"):
9494
EasyOCRConfig(lang_list=[])
9595
# raise error if cache_ttl is negative
96-
with pytest.raises(ValueError, match="cache_ttl must be non-negative"):
97-
EasyOCRConfig(cache_ttl=-1)
96+
with pytest.raises(ValueError, match="cache_ttl must be positive"):
97+
EasyOCRConfig(cache_ttl=0)
9898

9999

100100

0 commit comments

Comments
 (0)