-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
6.0.0rc1 pytest.fixture mypy error: Value of type "object" is not indexable #7494
Copy link
Copy link
Closed
Closed
Copy link
Labels
topic: typingtype-annotation issuetype-annotation issue
Description
- a detailed description of the bug or suggestion
- output of
pip listfrom the virtual environment you are using - pytest and operating system versions
- minimal example if possible
# file: pytest-mypy.py
import pytest
@pytest.fixture(params=[(0, 0), (1, 1)], ids=lambda x: x[0])
def b(request):
return request.param
def test_b(b):
pass
$ pytest ~/pytest-mypy.py -vv
=========================================================================== test session starts ============================================================================
platform win32 -- Python 3.8.3, pytest-6.0.0rc1, py-1.9.0, pluggy-0.13.1 -- c:\users\simon\anaconda3\envs\pandas-dev\python.exe
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('C:\\Users\\simon\\pandas\\.hypothesis\\examples')
rootdir: C:\Users\simon
plugins: hypothesis-5.16.3, asyncio-0.12.0, cov-2.10.0, forked-1.1.2, xdist-1.32.0
collected 2 items
..\pytest-mypy.py::test_b[0] PASSED [ 50%]
..\pytest-mypy.py::test_b[1] PASSED [100%]
============================================================================ 2 passed in 0.17s =============================================================================
$ mypy ~/pytest-mypy.py
C:\Users\simon\pytest-mypy.py:4: error: Value of type "object" is not indexable
Found 1 error in 1 file (checked 1 source file)
the type annotation for ids in fixture is
ids: Optional[
Union[
Iterable[Union[None, str, float, int, bool]],
Callable[[object], Optional[object]],
]
] = None,
i believe that the Callable should accept Any.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
topic: typingtype-annotation issuetype-annotation issue