fix: fixed the parser component (#7303)
* fix: fixed the parser component * fix: fixed parser component test * fix: ruff error * chore: rename input * chore: remove beta attribute * fix: remove name attribute --------- Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
This commit is contained in:
parent
6c36f4895b
commit
85787cf53e
2 changed files with 30 additions and 28 deletions
|
|
@ -17,7 +17,7 @@ class TestParserComponent(ComponentTestBaseWithoutClient):
|
|||
"""Return the default kwargs for the component."""
|
||||
return {
|
||||
"input_data": DataFrame({"Name": ["John"], "Age": [30], "Country": ["USA"]}),
|
||||
"template": "Name: {Name}, Age: {Age}, Country: {Country}",
|
||||
"pattern": "Name: {Name}, Age: {Age}, Country: {Country}",
|
||||
"sep": "\n",
|
||||
"stringify": False,
|
||||
"clean_data": False,
|
||||
|
|
@ -44,7 +44,7 @@ class TestParserComponent(ComponentTestBaseWithoutClient):
|
|||
data = Data(text="Hello World")
|
||||
kwargs = {
|
||||
"input_data": data,
|
||||
"template": "text: {text}",
|
||||
"pattern": "text: {text}",
|
||||
"sep": "\n",
|
||||
"stringify": False,
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ class TestParserComponent(ComponentTestBaseWithoutClient):
|
|||
data_frame = DataFrame({"Name": ["John", "Jane"], "Age": [30, 25]})
|
||||
kwargs = {
|
||||
"input_data": data_frame,
|
||||
"stringify": True,
|
||||
"mode": "Stringify",
|
||||
"clean_data": False,
|
||||
}
|
||||
component = component_class(**kwargs)
|
||||
|
|
@ -101,7 +101,7 @@ class TestParserComponent(ComponentTestBaseWithoutClient):
|
|||
message = Message(text="Test message content")
|
||||
kwargs = {
|
||||
"input_data": message,
|
||||
"stringify": True,
|
||||
"mode": "Stringify",
|
||||
}
|
||||
component = component_class(**kwargs)
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ class TestParserComponent(ComponentTestBaseWithoutClient):
|
|||
)
|
||||
kwargs = {
|
||||
"input_data": data_frame,
|
||||
"stringify": True,
|
||||
"mode": "Stringify",
|
||||
"clean_data": True,
|
||||
}
|
||||
component = component_class(**kwargs)
|
||||
|
|
@ -150,7 +150,7 @@ class TestParserComponent(ComponentTestBaseWithoutClient):
|
|||
# Arrange
|
||||
kwargs = {
|
||||
"input_data": 123, # Invalid input type
|
||||
"template": "{value}",
|
||||
"pattern": "{value}",
|
||||
"sep": "\n",
|
||||
}
|
||||
component = component_class(**kwargs)
|
||||
|
|
@ -163,7 +163,7 @@ class TestParserComponent(ComponentTestBaseWithoutClient):
|
|||
# Arrange
|
||||
kwargs = {
|
||||
"input_data": None,
|
||||
"template": "{value}",
|
||||
"pattern": "{value}",
|
||||
"sep": "\n",
|
||||
}
|
||||
component = component_class(**kwargs)
|
||||
|
|
@ -177,7 +177,7 @@ class TestParserComponent(ComponentTestBaseWithoutClient):
|
|||
data_frame = DataFrame({"Name": ["John"]})
|
||||
kwargs = {
|
||||
"input_data": data_frame,
|
||||
"template": "{InvalidColumn}", # Invalid column name
|
||||
"pattern": "{InvalidColumn}", # Invalid column name
|
||||
"sep": "\n",
|
||||
"stringify": False,
|
||||
}
|
||||
|
|
@ -197,9 +197,9 @@ class TestParserComponent(ComponentTestBaseWithoutClient):
|
|||
)
|
||||
kwargs = {
|
||||
"input_data": data_frame,
|
||||
"template": "{Name} is {Age} years old",
|
||||
"pattern": "{Name} is {Age} years old",
|
||||
"sep": " | ",
|
||||
"stringify": False,
|
||||
"mode": "Parser",
|
||||
}
|
||||
component = component_class(**kwargs)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue