diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py index b832eb90aa422..05812ca466d3f 100644 --- a/pandas/core/groupby/groupby.py +++ b/pandas/core/groupby/groupby.py @@ -3129,6 +3129,7 @@ def _nth( dropped = self.obj.dropna(how=dropna, axis=self.axis) # get a new grouper for our dropped obj + grouper: np.ndarray | Index | ops.BaseGrouper if self.keys is None and self.level is None: # we don't have the grouper info available # (e.g. we have selected out diff --git a/pandas/tests/io/test_clipboard.py b/pandas/tests/io/test_clipboard.py index 3bcf5b823647e..b5e040e05e8f7 100644 --- a/pandas/tests/io/test_clipboard.py +++ b/pandas/tests/io/test_clipboard.py @@ -4,7 +4,10 @@ import numpy as np import pytest -from pandas.compat import is_ci_environment +from pandas.compat import ( + is_ci_environment, + is_platform_mac, +) from pandas.errors import ( PyperclipException, PyperclipWindowsException, @@ -401,7 +404,8 @@ def test_round_trip_valid_encodings(self, enc, df): @pytest.mark.single_cpu @pytest.mark.parametrize("data", ["\U0001f44d...", "Ωœ∑´...", "abcd..."]) @pytest.mark.xfail( - os.environ.get("DISPLAY") is None or is_ci_environment(), + (os.environ.get("DISPLAY") is None and not is_platform_mac()) + or is_ci_environment(), reason="Cannot pass if a headless system is not put in place with Xvfb", strict=not is_ci_environment(), # Flaky failures in the CI ) diff --git a/pandas/tests/io/xml/test_to_xml.py b/pandas/tests/io/xml/test_to_xml.py index 5203506683be7..4843f40d6813d 100644 --- a/pandas/tests/io/xml/test_to_xml.py +++ b/pandas/tests/io/xml/test_to_xml.py @@ -991,7 +991,9 @@ def test_stylesheet_file_like(datapath, mode): def test_stylesheet_io(datapath, mode): xsl_path = datapath("io", "data", "xml", "row_field_output.xsl") - 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] with open(xsl_path, mode) as f: if mode == "rb": diff --git a/pandas/tests/io/xml/test_xml.py b/pandas/tests/io/xml/test_xml.py index a53e5f247c73a..071bc67d2dad9 100644 --- a/pandas/tests/io/xml/test_xml.py +++ b/pandas/tests/io/xml/test_xml.py @@ -1170,7 +1170,9 @@ def test_stylesheet_io(datapath, mode): kml = datapath("io", "data", "xml", "cta_rail_lines.kml") xsl = datapath("io", "data", "xml", "flatten_doc.xsl") - 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] with open(xsl, mode) as f: if mode == "rb": @@ -1349,7 +1351,9 @@ def test_stylesheet_file_close(datapath, mode): kml = datapath("io", "data", "xml", "cta_rail_lines.kml") xsl = datapath("io", "data", "xml", "flatten_doc.xsl") - 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] with open(xsl, mode) as f: if mode == "rb": diff --git a/pandas/tests/test_register_accessor.py b/pandas/tests/test_register_accessor.py index a1a74dda4bd6f..a76e4b09b7f4d 100644 --- a/pandas/tests/test_register_accessor.py +++ b/pandas/tests/test_register_accessor.py @@ -8,7 +8,7 @@ from pandas.core import accessor -def test_dirname_mixin(): +def test_dirname_mixin() -> None: # GH37173 class X(accessor.DirNamesMixin):