-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Works a bit more on tests and adds some fixtures
- Loading branch information
Showing
3 changed files
with
123 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from typing import Any | ||
from typing import List | ||
from typing import Tuple | ||
from typing import Type | ||
from typing import Union | ||
|
||
import pytest | ||
from _pytest.fixtures import FixtureRequest | ||
|
||
from pytest_static.parametric import ExpandedType | ||
from pytest_static.parametric import T | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def expanded_type( | ||
request: FixtureRequest, | ||
primary_type: Type[T], | ||
type_args: Tuple[Union[Any, ExpandedType[Any]], ...], | ||
) -> ExpandedType[T]: | ||
return getattr( | ||
request, | ||
"param", | ||
ExpandedType( | ||
primary_type=primary_type, | ||
type_args=type_args, | ||
), | ||
) | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def primary_type(request: FixtureRequest) -> Type[T]: | ||
return getattr(request, "param", List) | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def type_args(request: FixtureRequest) -> Tuple[Union[Any, ExpandedType[Any]], ...]: | ||
return getattr(request, "param", (int,)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters