Testing conversion of coordinate to cell_key

This commit is contained in:
Darren Burns
2023-02-02 15:40:24 +00:00
parent 87808c63b2
commit 62fb9d58bd

View File

@@ -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)