From 1c868d5833ee4347742495a6e96a6f9085e0cfa0 Mon Sep 17 00:00:00 2001 From: minhtuevo Date: Wed, 20 Nov 2024 23:26:15 -0800 Subject: [PATCH] Upated style --- fiftyone/operators/types.py | 8 +++++--- tests/unittests/operators/view_tests.py | 25 +++++++++++++++++++++---- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/fiftyone/operators/types.py b/fiftyone/operators/types.py index 34c0c4fde26..ca029b895d9 100644 --- a/fiftyone/operators/types.py +++ b/fiftyone/operators/types.py @@ -1857,7 +1857,7 @@ def __init__(self, row, column, **kwargs): self.column = column def clone(self): - clone = Tooltip(self.row, self. column, **self._kwargs) + clone = Tooltip(self.row, self.column, **self._kwargs) return clone def to_json(self): @@ -1907,11 +1907,13 @@ def add_row_action( ) self.row_actions.append(row_action) return row_action - + def add_tooltip(self, row, column, value, **kwargs): for tooltip in self.tooltips: if tooltip.row == row and tooltip.column == column: - raise ValueError(f"Tooltip for row '{row}' and column '{column}' already exists") + raise ValueError( + f"Tooltip for row '{row}' and column '{column}' already exists" + ) tooltip = Tooltip(row=row, column=column, value=value, **kwargs) self.tooltips.append(tooltip) diff --git a/tests/unittests/operators/view_tests.py b/tests/unittests/operators/view_tests.py index 2cf9d94dcbc..88945ec92c1 100644 --- a/tests/unittests/operators/view_tests.py +++ b/tests/unittests/operators/view_tests.py @@ -15,12 +15,29 @@ def test_table_view_basic(self): mock_on_click = lambda: None - table.add_row_action("action1", on_click=mock_on_click, icon="icon1", color="primary", tooltip="Action 1") - table.add_row_action("action2", on_click=mock_on_click, icon="icon2", color="secondary", tooltip="Action 2") + table.add_row_action( + "action1", + on_click=mock_on_click, + icon="icon1", + color="primary", + tooltip="Action 1", + ) + table.add_row_action( + "action2", + on_click=mock_on_click, + icon="icon2", + color="secondary", + tooltip="Action 2", + ) with self.assertRaises(ValueError): - table.add_row_action("action1", on_click=mock_on_click, icon="icon3", color="primary", - tooltip="Action 3") + table.add_row_action( + "action1", + on_click=mock_on_click, + icon="icon3", + color="primary", + tooltip="Action 3", + ) table.add_tooltip(1, 1, "Tooltip 1") table.add_tooltip(1, 2, "Tooltip 2")