Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TYP/TST: tests/mypy complaints failing locally #52423

Merged
merged 5 commits into from Apr 7, 2023

Conversation

jbrockmendel
Copy link
Member

@jbrockmendel jbrockmendel commented Apr 4, 2023

This un-xfails-on-mac a test that is passing locally. Also suppresses some mypy complaints. I'm still complaints:

pandas/io/formats/printing.py:266: error: Incompatible types in assignment (expression has type "Tuple[Type[Dict[Any, Any]]]", base class "BaseFormatter" defined the type as "Type[str]")  [assignment]
pandas/core/dtypes/dtypes.py:865: error: Incompatible types in assignment (expression has type "Callable[[PeriodDtypeBase], int]", base class "PandasExtensionDtype" defined the type as "Callable[[PandasExtensionDtype], int]")  [assignment]

that I haven't found a solution for

xsl_obj: BytesIO | StringIO
# note: By default the bodies of untyped functions are not checked,
# consider using --check-untyped-defs
xsl_obj: BytesIO | StringIO # type: ignore[annotation-unchecked]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def test_stylesheet_io(datapath, mode) -> None: for mypy to check this function and not emit this note

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That works for test_dirname_mixin, for the others produces error: Untyped decorator makes function "test_stylesheet_io" untyped [misc]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure whether the following is worth it: could lie about skip_if_no

def skip_if_no(package: str, min_version: str | None = None): -> Callable[[F], F]: ...

A simpler version could just be to remove those xsl_obj: BytesIO | StringIO lines - they are not used by mypy/pyright anyways.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hopefully this can be handled correctly upstream pytest-dev/pytest#7469

@mroeschke mroeschke added the Typing type annotations, mypy/pyright type checking label Apr 6, 2023
@mroeschke mroeschke added this to the 2.1 milestone Apr 7, 2023
@mroeschke mroeschke merged commit c67fb96 into pandas-dev:main Apr 7, 2023
42 checks passed
@mroeschke
Copy link
Member

Thanks @jbrockmendel (can follow up with the other typings maybe if it makes things simpler)

@jbrockmendel jbrockmendel deleted the cln-annoying branch April 7, 2023 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants