Skip to content

Commit

Permalink
value error tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sjrl committed Feb 7, 2025
1 parent 626b6ba commit 1c5368a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/components/preprocessors/test_csv_document_splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,22 @@ def test_find_split_indices_column_three_tables(self, splitter: CSVDocumentSplit
assert result == [(2, 3), (6, 7)]


class TestInit:
def test_row_split_threshold_raises_error(self) -> None:
with pytest.raises(ValueError, match="row_split_threshold must be greater than 0"):
CSVDocumentSplitter(row_split_threshold=-1)

def test_column_split_threshold_raises_error(self) -> None:
with pytest.raises(ValueError, match="column_split_threshold must be greater than 0"):
CSVDocumentSplitter(column_split_threshold=-1)

def test_row_split_threshold_and_row_column_threshold_none(self) -> None:
with pytest.raises(
ValueError, match="At least one of row_split_threshold or column_split_threshold must be specified."
):
CSVDocumentSplitter(row_split_threshold=None, column_split_threshold=None)


class TestCSVDocumentSplitter:
def test_single_table_no_split(self, splitter: CSVDocumentSplitter) -> None:
csv_content = """A,B,C
Expand Down

0 comments on commit 1c5368a

Please sign in to comment.