Skip to content

Commit

Permalink
Simplify error message formatting in test cases for data components
Browse files Browse the repository at this point in the history
  • Loading branch information
ogabrielluiz committed Oct 22, 2024
1 parent 0ac0d8a commit a438a1f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest

from langflow.components.prototypes.CreateData import CreateDataComponent
from langflow.schema import Data

Expand Down Expand Up @@ -48,9 +49,7 @@ def test_update_build_config_exceed_limit(create_data_component):
"value": False,
},
}
with pytest.raises(
ValueError, match="Number of fields cannot exceed 15. Try using a Component to combine two Data."
):
with pytest.raises(ValueError, match="Number of fields cannot exceed 15."):
create_data_component.update_build_config(build_config, 16, "number_of_fields")


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest

from langflow.components.prototypes.UpdateData import UpdateDataComponent
from langflow.schema import Data

Expand Down Expand Up @@ -48,9 +49,7 @@ def test_update_build_config_exceed_limit(update_data_component):
"value": False,
},
}
with pytest.raises(
ValueError, match="Number of fields cannot exceed 15. Try using a Component to combine two Data."
):
with pytest.raises(ValueError, match="Number of fields cannot exceed 15."):
update_data_component.update_build_config(build_config, 16, "number_of_fields")


Expand Down Expand Up @@ -100,6 +99,6 @@ def test_validate_text_key_invalid(update_data_component):
update_data_component.validate_text_key(data)

expected_error_message = (
f"Text Key: {update_data_component.text_key} not found in the Data keys: {','.join(data.data.keys())}"
f"Text Key: '{update_data_component.text_key}' not found in the Data keys: {', '.join(data.data.keys())}"
)
assert str(exc_info.value) == expected_error_message

0 comments on commit a438a1f

Please sign in to comment.