Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ class FigureFactoryTableOpDesc extends PythonOperatorDescriptor {
|
|class TableChartOperator(UDFTableOperator):
|
| def render_error(self, error_msg) -> str:
| return f"<h1>Figure Factory Table is not available.</h1><p>Reason is: {error_msg}</p>"
|
| def process_table(self, table: Table, port: int) -> Iterator[Optional[TableLike]]:
|
| if table.empty:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ class TablesPlotOpDesc extends PythonOperatorDescriptor {
|import plotly.io
|class TableChartOperator(UDFTableOperator):
|
| def render_error(self, error_msg) -> str:
| return f"<h1>Tables Plot is not available.</h1><p>Reason is: {error_msg}</p>"
|
| def process_table(self, table: Table, port: int) -> Iterator[Optional[TableLike]]:
|
| if table.empty:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,15 @@ class FigureFactoryTableOpDescSpec extends AnyFlatSpec with BeforeAndAfter with
assert(carries(code, "col_two"))
code should include("class TableChartOperator(UDFTableOperator)")
}

it should "define the render_error the empty-table branches call" in {
// Both empty-table branches call self.render_error; without the definition they
// raised AttributeError instead of rendering the message.
withColumns()
val code = opDesc.generatePythonCode()
code should include("def render_error(self, error_msg) -> str:")
Comment thread
xuang7 marked this conversation as resolved.
code should include(
"""return f"<h1>Figure Factory Table is not available.</h1><p>Reason is: {error_msg}</p>""""
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,15 @@ class TablesPlotOpDescSpec extends AnyFlatSpec with BeforeAndAfter with Matchers
)
code should not include "')','"
}

it should "define the render_error the empty-table branches call" in {
// Both empty-table branches call self.render_error; without the definition they
// raised AttributeError instead of rendering the message.
opDesc.includedColumns = List(column("col_one"), column("col_two"))
val code = opDesc.generatePythonCode()
code should include("def render_error(self, error_msg) -> str:")
code should include(
"""return f"<h1>Tables Plot is not available.</h1><p>Reason is: {error_msg}</p>""""
)
}
}
Loading