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