-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed
AttributeError
issue in is_case_function
when an inspected …
…symbol is a parametrized type hint without `__name__` (#294) * Fixed #292 by dropping the associated nox sessions * Fixed `AttributeError: __name__` issue in `is_case_function` when an inspected symbol comes from the typing package. Fixes #287 --------- Co-authored-by: Sylvain MARIE <[email protected]>
- Loading branch information
Showing
3 changed files
with
32 additions
and
2 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
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,24 @@ | ||
from typing import Tuple | ||
|
||
import pytest_cases | ||
|
||
|
||
class Cases: | ||
ClassVar1 = int # OK | ||
ClassVar2 = int # OK | ||
ClassVar3 = 1 # OK | ||
ClassVar4 = float # OK | ||
|
||
ClassVar5 = Tuple[int] # FAILS with AttributeError: __name__ | ||
# ClassVar6 = Tuple[float] # FAILS with AttributeError: __name__ | ||
# ClassVar7 = List[int] # FAILS with AttributeError: __name__ | ||
# ClassVar8 = Any # FAILS with AttributeError: __name__ | ||
# ClassVar9 = Dict[int, str] # FAILS with AttributeError: __name__ | ||
|
||
def case_b(self): | ||
return 1 | ||
|
||
|
||
@pytest_cases.parametrize_with_cases("case", Cases) | ||
def test_something(case) -> None: | ||
pass |