Skip to content

Commit 963abe9

Browse files
authored
tests: add textual (#137)
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 6eb565c commit 963abe9

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ dependencies = [
5353
[project.optional-dependencies]
5454
test = [
5555
"pytest >=6",
56+
"pytest-asyncio",
5657
"scikit-hep-testdata",
5758
]
5859
iterm = [
@@ -87,6 +88,7 @@ filterwarnings = [
8788
]
8889
log_cli_level = "info"
8990
testpaths = ["tests"]
91+
asyncio_mode = "auto"
9092

9193

9294
[tool.mypy]

tests/test_tui.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from pathlib import Path
2+
3+
import skhep_testdata
4+
5+
from uproot_browser.tui.browser import Browser
6+
7+
8+
async def test_browse_logo() -> None:
9+
async with Browser(
10+
Path(skhep_testdata.data_path("uproot-Event.root"))
11+
).run_test() as pilot:
12+
assert pilot.app.query_one("#main-view").current == "logo"
13+
14+
15+
async def test_browse_plot() -> None:
16+
async with Browser(
17+
Path(skhep_testdata.data_path("uproot-Event.root"))
18+
).run_test() as pilot:
19+
await pilot.press("down", "down", "down", "enter")
20+
assert pilot.app.query_one("#main-view").current == "plot"
21+
22+
23+
async def test_browse_empty() -> None:
24+
async with Browser(
25+
Path(skhep_testdata.data_path("uproot-empty.root"))
26+
).run_test() as pilot:
27+
await pilot.press("down", "space", "down", "enter")
28+
assert pilot.app.query_one("#main-view").current == "empty"
29+
30+
31+
async def test_browse_empty_vim() -> None:
32+
async with Browser(
33+
Path(skhep_testdata.data_path("uproot-empty.root"))
34+
).run_test() as pilot:
35+
await pilot.press("j", "l", "j", "enter")
36+
assert pilot.app.query_one("#main-view").current == "empty"

0 commit comments

Comments
 (0)