Debian Codegraph @

tests/typing/typing_progressbar.py

raw
1 from __future__ import annotations
2
3 from typing_extensions import assert_type
4
5 from asyncclick import progressbar
6 from asyncclick._termui_impl import ProgressBar
7
8
9 def test_length_is_int() -> None:
10 with progressbar(length=5) as bar:
11 assert_type(bar, ProgressBar[int])
12 for i in bar:
13 assert_type(i, int)
14
15
16 def it() -> tuple[str, ...]:
17 return ("hello", "world")
18
19
20 def test_generic_on_iterable() -> None:
21 with progressbar(it()) as bar:
22 assert_type(bar, ProgressBar[str])
23 for s in bar:
24 assert_type(s, str)