Skip to content

Commit a438a1f

Browse files
committed
Simplify error message formatting in test cases for data components
1 parent 0ac0d8a commit a438a1f

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/backend/tests/unit/components/prototypes/test_create_data_component.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
23
from langflow.components.prototypes.CreateData import CreateDataComponent
34
from langflow.schema import Data
45

@@ -48,9 +49,7 @@ def test_update_build_config_exceed_limit(create_data_component):
4849
"value": False,
4950
},
5051
}
51-
with pytest.raises(
52-
ValueError, match="Number of fields cannot exceed 15. Try using a Component to combine two Data."
53-
):
52+
with pytest.raises(ValueError, match="Number of fields cannot exceed 15."):
5453
create_data_component.update_build_config(build_config, 16, "number_of_fields")
5554

5655

src/backend/tests/unit/components/prototypes/test_update_data_component.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
23
from langflow.components.prototypes.UpdateData import UpdateDataComponent
34
from langflow.schema import Data
45

@@ -48,9 +49,7 @@ def test_update_build_config_exceed_limit(update_data_component):
4849
"value": False,
4950
},
5051
}
51-
with pytest.raises(
52-
ValueError, match="Number of fields cannot exceed 15. Try using a Component to combine two Data."
53-
):
52+
with pytest.raises(ValueError, match="Number of fields cannot exceed 15."):
5453
update_data_component.update_build_config(build_config, 16, "number_of_fields")
5554

5655

@@ -100,6 +99,6 @@ def test_validate_text_key_invalid(update_data_component):
10099
update_data_component.validate_text_key(data)
101100

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

0 commit comments

Comments
 (0)