File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -199,6 +199,9 @@ def load_file(self, file):
199199
200200 def split (self , classifications : List [Classification ], strategy : SplittingStrategy = SplittingStrategy .EAGER ):
201201 """Split the document into groups based on classifications."""
202+ if self .splitter is None :
203+ raise ValueError ("No splitter loaded. Please load a splitter using load_splitter() before splitting." )
204+
202205 self .split_classifications = classifications
203206
204207 document_loader = self .get_document_loader (self .file_path )
Original file line number Diff line number Diff line change 77from tests .models .driver_license import DriverLicense
88from extract_thinker .image_splitter import ImageSplitter
99from extract_thinker .text_splitter import TextSplitter
10+ import pytest
1011
1112# Setup environment and paths
1213load_dotenv ()
@@ -154,5 +155,11 @@ def test_eager_splitting_strategy_vision():
154155 assert result [1 ].license_number .replace (" " , "" ) in ["0123456789" , "123456789" ]
155156 #assert result[1].license_number.replace(" ", "") == "0123456789" #small vision bug from the model, refuses to return 0 on driver license
156157
157- if __name__ == "__main__" :
158- test_eager_splitting_strategy ()
158+ def test_split_requires_splitter ():
159+ """Test that attempting to split without loading a splitter first raises an error"""
160+ # Arrange
161+ process = Process ()
162+
163+ # Act & Assert
164+ with pytest .raises (ValueError , match = "No splitter loaded" ):
165+ process .split ([]) # Empty classifications list is fine for this test
You can’t perform that action at this time.
0 commit comments