Skip to content

Commit c67fb96

Browse files
authored
TYP/TST: tests/mypy complaints failing locally (#52423)
* unxfail on mac * TYP: silence mypy complaints * TYP: avoid mypy complaint in groupby * ignore a little less
1 parent d5bfd2b commit c67fb96

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

pandas/core/groupby/groupby.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3135,6 +3135,7 @@ def _nth(
31353135
dropped = self.obj.dropna(how=dropna, axis=self.axis)
31363136

31373137
# get a new grouper for our dropped obj
3138+
grouper: np.ndarray | Index | ops.BaseGrouper
31383139
if self.keys is None and self.level is None:
31393140
# we don't have the grouper info available
31403141
# (e.g. we have selected out

pandas/tests/io/test_clipboard.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
import numpy as np
55
import pytest
66

7-
from pandas.compat import is_ci_environment
7+
from pandas.compat import (
8+
is_ci_environment,
9+
is_platform_mac,
10+
)
811
from pandas.errors import (
912
PyperclipException,
1013
PyperclipWindowsException,
@@ -401,7 +404,8 @@ def test_round_trip_valid_encodings(self, enc, df):
401404
@pytest.mark.single_cpu
402405
@pytest.mark.parametrize("data", ["\U0001f44d...", "Ωœ∑´...", "abcd..."])
403406
@pytest.mark.xfail(
404-
os.environ.get("DISPLAY") is None or is_ci_environment(),
407+
(os.environ.get("DISPLAY") is None and not is_platform_mac())
408+
or is_ci_environment(),
405409
reason="Cannot pass if a headless system is not put in place with Xvfb",
406410
strict=not is_ci_environment(), # Flaky failures in the CI
407411
)

pandas/tests/io/xml/test_to_xml.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,9 @@ def test_stylesheet_file_like(datapath, mode):
991991
def test_stylesheet_io(datapath, mode):
992992
xsl_path = datapath("io", "data", "xml", "row_field_output.xsl")
993993

994-
xsl_obj: BytesIO | StringIO
994+
# note: By default the bodies of untyped functions are not checked,
995+
# consider using --check-untyped-defs
996+
xsl_obj: BytesIO | StringIO # type: ignore[annotation-unchecked]
995997

996998
with open(xsl_path, mode) as f:
997999
if mode == "rb":

pandas/tests/io/xml/test_xml.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,9 @@ def test_stylesheet_io(datapath, mode):
11701170
kml = datapath("io", "data", "xml", "cta_rail_lines.kml")
11711171
xsl = datapath("io", "data", "xml", "flatten_doc.xsl")
11721172

1173-
xsl_obj: BytesIO | StringIO
1173+
# note: By default the bodies of untyped functions are not checked,
1174+
# consider using --check-untyped-defs
1175+
xsl_obj: BytesIO | StringIO # type: ignore[annotation-unchecked]
11741176

11751177
with open(xsl, mode) as f:
11761178
if mode == "rb":
@@ -1349,7 +1351,9 @@ def test_stylesheet_file_close(datapath, mode):
13491351
kml = datapath("io", "data", "xml", "cta_rail_lines.kml")
13501352
xsl = datapath("io", "data", "xml", "flatten_doc.xsl")
13511353

1352-
xsl_obj: BytesIO | StringIO
1354+
# note: By default the bodies of untyped functions are not checked,
1355+
# consider using --check-untyped-defs
1356+
xsl_obj: BytesIO | StringIO # type: ignore[annotation-unchecked]
13531357

13541358
with open(xsl, mode) as f:
13551359
if mode == "rb":

pandas/tests/test_register_accessor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from pandas.core import accessor
99

1010

11-
def test_dirname_mixin():
11+
def test_dirname_mixin() -> None:
1212
# GH37173
1313

1414
class X(accessor.DirNamesMixin):

0 commit comments

Comments
 (0)