mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Testing DataTable.get_column
This commit is contained in:
@@ -376,7 +376,7 @@ async def test_get_row_invalid_row_key():
|
||||
async with app.run_test():
|
||||
table = app.query_one(DataTable)
|
||||
with pytest.raises(RowDoesNotExist):
|
||||
table.get_row("abc")
|
||||
table.get_row("INVALID")
|
||||
|
||||
|
||||
async def test_get_row_at():
|
||||
@@ -409,6 +409,20 @@ async def test_get_row_at_invalid_index(index):
|
||||
table.get_row_at(index)
|
||||
|
||||
|
||||
async def test_get_column():
|
||||
app = DataTableApp()
|
||||
async with app.run_test():
|
||||
table = app.query_one(DataTable)
|
||||
a, b = table.add_columns("A", "B")
|
||||
table.add_rows(ROWS)
|
||||
cells = table.get_column(a)
|
||||
assert next(cells) == ROWS[0][0]
|
||||
assert next(cells) == ROWS[1][0]
|
||||
assert next(cells) == ROWS[2][0]
|
||||
with pytest.raises(StopIteration):
|
||||
next(cells)
|
||||
|
||||
|
||||
async def test_update_cell_cell_exists():
|
||||
app = DataTableApp()
|
||||
async with app.run_test():
|
||||
|
||||
Reference in New Issue
Block a user