mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
18 lines
470 B
Python
18 lines
470 B
Python
from textual.app import App
|
|
|
|
|
|
def test_batch_update():
|
|
"""Test `batch_update` context manager"""
|
|
app = App()
|
|
assert app._batch_count == 0 # Start at zero
|
|
|
|
with app.batch_update():
|
|
assert app._batch_count == 1 # Increments in context manager
|
|
|
|
with app.batch_update():
|
|
assert app._batch_count == 2 # Nested updates
|
|
|
|
assert app._batch_count == 1 # Exiting decrements
|
|
|
|
assert app._batch_count == 0 # Back to zero
|