@@ -92,6 +92,19 @@ def test_partition_via_api_raises_with_bad_response(monkeypatch):
9292 partition_via_api (filename = filename , api_key = "FAKEROO" )
9393
9494
95+ def test_partition_via_api_valid_request_data_kwargs ():
96+ filename = os .path .join (DIRECTORY , ".." , ".." , "example-docs" , "layout-parser-paper-fast.pdf" )
97+
98+ elements = partition_via_api (filename = filename , api_key = "FAKEROO" , strategy = "fast" )
99+ assert isinstance (elements , list )
100+
101+
102+ def test_partition_via_api_invalid_request_data_kwargs ():
103+ filename = os .path .join (DIRECTORY , ".." , ".." , "example-docs" , "layout-parser-paper-fast.pdf" )
104+ with pytest .raises (ValueError ):
105+ partition_via_api (filename = filename , api_key = "FAKEROO" , strategy = "not_a_strategy" )
106+
107+
95108class MockMultipleResponse :
96109 def __init__ (self , status_code ):
97110 self .status_code = status_code
@@ -276,3 +289,27 @@ def test_partition_multiple_via_api_from_files_raises_without_filenames(monkeypa
276289 files = files ,
277290 api_key = "FAKEROO" ,
278291 )
292+
293+
294+ def test_partition_multiple_via_api_valid_request_data_kwargs ():
295+ filenames = [
296+ os .path .join (DIRECTORY , ".." , ".." , "example-docs" , "layout-parser-paper-fast.pdf" ),
297+ os .path .join (DIRECTORY , ".." , ".." , "example-docs" , "layout-parser-paper-fast.jpg" ),
298+ ]
299+
300+ elements = partition_multiple_via_api (filenames = filenames , api_key = "FAKEROO" , strategy = "fast" )
301+ assert isinstance (elements , list )
302+
303+
304+ def test_partition_multiple_via_api_invalid_request_data_kwargs ():
305+ filenames = [
306+ os .path .join (DIRECTORY , ".." , ".." , "example-docs" , "layout-parser-paper-fast.pdf" ),
307+ os .path .join (DIRECTORY , ".." , ".." , "example-docs" , "layout-parser-paper-fast.jpg" ),
308+ ]
309+
310+ with pytest .raises (ValueError ):
311+ partition_multiple_via_api (
312+ filenames = filenames ,
313+ api_key = "FAKEROO" ,
314+ strategy = "not_a_strategy" ,
315+ )
0 commit comments