From 1c5368a896df27345bd3869eb8f5ab90fe321409 Mon Sep 17 00:00:00 2001 From: Sebastian Husch Lee Date: Fri, 7 Feb 2025 14:37:51 +0100 Subject: [PATCH] value error tests --- .../preprocessors/test_csv_document_splitter.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/components/preprocessors/test_csv_document_splitter.py b/test/components/preprocessors/test_csv_document_splitter.py index 697178539a..37b589d87e 100644 --- a/test/components/preprocessors/test_csv_document_splitter.py +++ b/test/components/preprocessors/test_csv_document_splitter.py @@ -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