From 62fb9d58bdf72fba52fa4611d3afce029380078d Mon Sep 17 00:00:00 2001 From: Darren Burns Date: Thu, 2 Feb 2023 15:40:24 +0000 Subject: [PATCH] Testing conversion of coordinate to cell_key --- tests/test_data_table.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_data_table.py b/tests/test_data_table.py index fed155f8b..49d490a06 100644 --- a/tests/test_data_table.py +++ b/tests/test_data_table.py @@ -8,6 +8,7 @@ from textual.app import App from textual.coordinate import Coordinate from textual.message import Message from textual.widgets import DataTable +from textual.widgets._data_table import CellKey from textual.widgets.data_table import ( CellDoesNotExist, RowKey, @@ -367,6 +368,17 @@ async def test_update_coordinate_column_width(label, new_value, new_content_widt assert first_column.render_width == new_content_width + 2 +async def test_coordinate_to_cell_key(): + app = DataTableApp() + async with app.run_test(): + table = app.query_one(DataTable) + column_key, _ = table.add_columns("Column0", "Column1") + row_key = table.add_row("A", "B") + + cell_key = table.coordinate_to_cell_key(Coordinate(0, 0)) + assert cell_key == CellKey(row_key, column_key) + + def test_key_equals_equivalent_string(): text = "Hello" key = RowKey(text)