mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Testing conversion of coordinate to cell_key
This commit is contained in:
@@ -8,6 +8,7 @@ from textual.app import App
|
|||||||
from textual.coordinate import Coordinate
|
from textual.coordinate import Coordinate
|
||||||
from textual.message import Message
|
from textual.message import Message
|
||||||
from textual.widgets import DataTable
|
from textual.widgets import DataTable
|
||||||
|
from textual.widgets._data_table import CellKey
|
||||||
from textual.widgets.data_table import (
|
from textual.widgets.data_table import (
|
||||||
CellDoesNotExist,
|
CellDoesNotExist,
|
||||||
RowKey,
|
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
|
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():
|
def test_key_equals_equivalent_string():
|
||||||
text = "Hello"
|
text = "Hello"
|
||||||
key = RowKey(text)
|
key = RowKey(text)
|
||||||
|
|||||||
Reference in New Issue
Block a user