Skip to content

Commit 7279647

Browse files
author
Sylvain MARIE
committed
Fixed type hints for #148 : the appropriate type hint is Iterable[str], it encompasses all cases we dupport for ids
1 parent 1c69639 commit 7279647

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

docs/api_reference.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def fixture_union(name: str,
186186
fixtures: Iterable[Union[str, Callable]],
187187
scope: str = "function",
188188
idstyle: Optional[str] = 'explicit',
189-
ids: Union[Callable, List[str]] = None,
189+
ids: Union[Callable, Iterable[str]] = None,
190190
unpack_into: Iterable[str] = None,
191191
autouse: bool = False,
192192
hook: Callable = None,
@@ -221,7 +221,7 @@ The style of test ids corresponding to the union alternatives can be changed wit
221221
def param_fixtures(argnames: str,
222222
argvalues: Iterable[Any],
223223
autouse: bool = False,
224-
ids: Union[Callable, List[str]] = None,
224+
ids: Union[Callable, Iterable[str]] = None,
225225
scope: str = "function",
226226
hook: Callable = None,
227227
debug: bool = False,
@@ -275,7 +275,7 @@ Identical to `param_fixtures` but for a single parameter name, so that you can a
275275
@parametrize_plus(argnames: str=None,
276276
argvalues: Iterable[Any]=None,
277277
indirect: bool = False,
278-
ids: Union[Callable, List[str]] = None,
278+
ids: Union[Callable, Iterable[str]] = None,
279279
idstyle: str = 'explicit',
280280
idgen: Union[str, Callable] = _IDGEN,
281281
scope: str = None,

pytest_cases/fixture_core1_unions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from funcsigs import signature, Parameter # noqa
1818

1919
try: # type hints, python 3+
20-
from typing import Callable, Union, Optional, Any, List, Iterable, Sequence, Generator # noqa
20+
from typing import Callable, Union, Optional, Any, List, Iterable, Sequence # noqa
2121
from types import ModuleType # noqa
2222
except ImportError:
2323
pass
@@ -208,7 +208,7 @@ def fixture_union(name, # type: str
208208
fixtures, # type: Iterable[Union[str, Callable]]
209209
scope="function", # type: str
210210
idstyle='explicit', # type: Optional[str]
211-
ids=None, # type: Union[Callable, List[str], Generator[str, None, None]]
211+
ids=None, # type: Union[Callable, Iterable[str]]
212212
unpack_into=None, # type: Iterable[str]
213213
autouse=False, # type: bool
214214
hook=None, # type: Callable[[Callable], Callable]
@@ -292,7 +292,7 @@ def _fixture_union(fixtures_dest,
292292
unique_fix_alt_names, # type: List[str]
293293
scope="function", # type: str
294294
idstyle="explicit", # type: str
295-
ids=None, # type: Union[Callable, List[str], Generator[str, None, None]]
295+
ids=None, # type: Union[Callable, Iterable[str]]
296296
autouse=False, # type: bool
297297
hook=None, # type: Callable[[Callable], Callable]
298298
caller=fixture_union, # type: Callable

pytest_cases/fixture_core2.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from funcsigs import signature, Parameter # noqa
2121

2222
try: # type hints, python 3+
23-
from typing import Callable, Union, Any, List, Iterable, Sequence, Generator # noqa
23+
from typing import Callable, Union, Any, List, Iterable, Sequence # noqa
2424
from types import ModuleType # noqa
2525
except ImportError:
2626
pass
@@ -36,7 +36,7 @@
3636
def param_fixture(argname, # type: str
3737
argvalues, # type: Iterable[Any]
3838
autouse=False, # type: bool
39-
ids=None, # type: Union[Callable, List[str], Generator[str, None, None]]
39+
ids=None, # type: Union[Callable, Iterable[str]]
4040
scope="function", # type: str
4141
hook=None, # type: Callable[[Callable], Callable]
4242
debug=False, # type: bool
@@ -90,7 +90,7 @@ def _create_param_fixture(fixtures_dest,
9090
argname, # type: str
9191
argvalues, # type: Sequence[Any]
9292
autouse=False, # type: bool
93-
ids=None, # type: Union[Callable, List[str], Generator[str, None, None]]
93+
ids=None, # type: Union[Callable, Iterable[str]]
9494
scope="function", # type: str
9595
hook=None, # type: Callable[[Callable], Callable]
9696
auto_simplify=False,
@@ -135,7 +135,7 @@ def __param_fixture(request):
135135
def param_fixtures(argnames, # type: str
136136
argvalues, # type: Iterable[Any]
137137
autouse=False, # type: bool
138-
ids=None, # type: Union[Callable, List[str], Generator[str, None, None]]
138+
ids=None, # type: Union[Callable, Iterable[str]]
139139
scope="function", # type: str
140140
hook=None, # type: Callable[[Callable], Callable]
141141
debug=False, # type: bool
@@ -193,7 +193,7 @@ def _create_params_fixture(fixtures_dest,
193193
argnames_lst, # type: Sequence[str]
194194
argvalues, # type: Sequence[Any]
195195
autouse=False, # type: bool
196-
ids=None, # type: Union[Callable, List[str], Generator[str, None, None]]
196+
ids=None, # type: Union[Callable, Iterable[str]]
197197
scope="function", # type: str
198198
hook=None, # type: Callable[[Callable], Callable]
199199
debug=False, # type: bool

pytest_cases/fixture_parametrize_plus.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from funcsigs import signature, Parameter # noqa
1414

1515
try:
16-
from typing import Union, Callable, List, Any, Sequence, Optional, Generator # noqa
16+
from typing import Union, Callable, List, Any, Sequence, Optional # noqa
1717

1818
except ImportError:
1919
pass
@@ -39,7 +39,7 @@ def _fixture_product(fixtures_dest,
3939
fixtures_or_values,
4040
fixture_positions,
4141
scope="function", # type: str
42-
ids=None, # type: Union[Callable, List[str], Generator[str, None, None]]
42+
ids=None, # type: Union[Callable, Iterable[str]]
4343
unpack_into=None, # type: Iterable[str]
4444
autouse=False, # type: bool
4545
hook=None, # type: Callable[[Callable], Callable]
@@ -283,7 +283,7 @@ def get(cls, style # type: str
283283
def parametrize_plus(argnames=None, # type: str
284284
argvalues=None, # type: Iterable[Any]
285285
indirect=False, # type: bool
286-
ids=None, # type: Union[Callable, List[str], Generator[str, None, None]]
286+
ids=None, # type: Union[Callable, Iterable[str]]
287287
idstyle='explicit', # type: str
288288
idgen=_IDGEN, # type: Union[str, Callable]
289289
scope=None, # type: str
@@ -378,7 +378,7 @@ def __repr__(self):
378378
def _parametrize_plus(argnames=None,
379379
argvalues=None,
380380
indirect=False, # type: bool
381-
ids=None, # type: Union[Callable, List[str], Generator[str, None, None]]
381+
ids=None, # type: Union[Callable, Iterable[str]]
382382
idstyle='explicit', # type: str
383383
idgen=_IDGEN, # type: Union[str, Callable]
384384
scope=None, # type: str

0 commit comments

Comments
 (0)