diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 5d50df4ffd20..4a1b54e46e47 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -33,7 +33,7 @@ import matplotlib.text as mtext import matplotlib.ticker as mticker import matplotlib.transforms as mtransforms -import mpl_toolkits.axisartist as AA # type: ignore +import mpl_toolkits.axisartist as AA # type: ignore[import] from numpy.testing import ( assert_allclose, assert_array_equal, assert_array_almost_equal) from matplotlib.testing.decorators import ( @@ -2976,7 +2976,7 @@ def test_scatter_singular_plural_arguments(self): def _params(c=None, xsize=2, *, edgecolors=None, **kwargs): - return (c, edgecolors, kwargs if kwargs is not None else {}, xsize) + return (c, edgecolors, kwargs, xsize) _result = namedtuple('_result', 'c, colors') diff --git a/lib/matplotlib/tests/test_backend_gtk3.py b/lib/matplotlib/tests/test_backend_gtk3.py index d7fa4329cfc8..11a3a10c31cb 100644 --- a/lib/matplotlib/tests/test_backend_gtk3.py +++ b/lib/matplotlib/tests/test_backend_gtk3.py @@ -7,7 +7,7 @@ def test_correct_key(): pytest.xfail("test_widget_send_event is not triggering key_press_event") - from gi.repository import Gdk, Gtk # type: ignore + from gi.repository import Gdk, Gtk # type: ignore[import] fig = plt.figure() buf = [] diff --git a/lib/matplotlib/tests/test_backend_qt.py b/lib/matplotlib/tests/test_backend_qt.py index 5eb1ea77554d..83d169e5c701 100644 --- a/lib/matplotlib/tests/test_backend_qt.py +++ b/lib/matplotlib/tests/test_backend_qt.py @@ -15,7 +15,8 @@ from matplotlib import _c_internal_utils try: - from matplotlib.backends.qt_compat import QtGui, QtWidgets # type: ignore # noqa + from matplotlib.backends.qt_compat import QtGui # type: ignore[attr-defined] # noqa: E501, F401 + from matplotlib.backends.qt_compat import QtWidgets # type: ignore[attr-defined] from matplotlib.backends.qt_editor import _formlayout except ImportError: pytestmark = pytest.mark.skip('No usable Qt bindings') diff --git a/lib/matplotlib/tests/test_backends_interactive.py b/lib/matplotlib/tests/test_backends_interactive.py index 7621ac5b5689..05f59ce39fa4 100644 --- a/lib/matplotlib/tests/test_backends_interactive.py +++ b/lib/matplotlib/tests/test_backends_interactive.py @@ -86,7 +86,7 @@ def _get_available_interactive_backends(): reason = "macosx backend fails on Azure" elif env["MPLBACKEND"].startswith('gtk'): try: - import gi # type: ignore + import gi # type: ignore[import] except ImportError: # Though we check that `gi` exists above, it is possible that its # C-level dependencies are not available, and then it still raises an diff --git a/lib/matplotlib/tests/test_basic.py b/lib/matplotlib/tests/test_basic.py index 6bd417876857..f6aa1e458555 100644 --- a/lib/matplotlib/tests/test_basic.py +++ b/lib/matplotlib/tests/test_basic.py @@ -11,7 +11,7 @@ def test_simple(): def test_override_builtins(): - import pylab # type: ignore + import pylab # type: ignore[import] ok_to_override = { '__name__', '__doc__', diff --git a/lib/matplotlib/tests/test_cbook.py b/lib/matplotlib/tests/test_cbook.py index 435745e03e16..a8faa9be3782 100644 --- a/lib/matplotlib/tests/test_cbook.py +++ b/lib/matplotlib/tests/test_cbook.py @@ -186,7 +186,7 @@ def dummy(self): pass class Unhashable: - __hash__ = None # type: ignore + __hash__ = None # type: ignore[assignment] def dummy(self): pass diff --git a/lib/matplotlib/tests/test_collections.py b/lib/matplotlib/tests/test_collections.py index 44292cbc1d53..19af38f3b522 100644 --- a/lib/matplotlib/tests/test_collections.py +++ b/lib/matplotlib/tests/test_collections.py @@ -456,7 +456,7 @@ def test_EllipseCollection_setter_getter(): @image_comparison(['polycollection_close.png'], remove_text=True, style='mpl20') def test_polycollection_close(): - from mpl_toolkits.mplot3d import Axes3D # type: ignore + from mpl_toolkits.mplot3d import Axes3D # type: ignore[import] plt.rcParams['axes3d.automargin'] = True vertsQuad = [ diff --git a/lib/matplotlib/tests/test_colors.py b/lib/matplotlib/tests/test_colors.py index 3fd7cbdc9d46..af77522e50ac 100644 --- a/lib/matplotlib/tests/test_colors.py +++ b/lib/matplotlib/tests/test_colors.py @@ -1415,7 +1415,7 @@ def test_ndarray_subclass_norm(): # which objects when adding or subtracting with other # arrays. See #6622 and #8696 class MyArray(np.ndarray): - def __isub__(self, other): # type: ignore + def __isub__(self, other): # type: ignore[misc] raise RuntimeError def __add__(self, other): diff --git a/lib/matplotlib/tests/test_legend.py b/lib/matplotlib/tests/test_legend.py index cf0a950de1ca..61892378bd03 100644 --- a/lib/matplotlib/tests/test_legend.py +++ b/lib/matplotlib/tests/test_legend.py @@ -402,7 +402,7 @@ def test_warn_mixed_args_and_kwargs(self): "be discarded.") def test_parasite(self): - from mpl_toolkits.axes_grid1 import host_subplot # type: ignore + from mpl_toolkits.axes_grid1 import host_subplot # type: ignore[import] host = host_subplot(111) par = host.twinx() diff --git a/lib/matplotlib/tests/test_pickle.py b/lib/matplotlib/tests/test_pickle.py index 8bb7ef9deb54..eb47b2668101 100644 --- a/lib/matplotlib/tests/test_pickle.py +++ b/lib/matplotlib/tests/test_pickle.py @@ -17,7 +17,7 @@ import matplotlib.pyplot as plt import matplotlib.transforms as mtransforms import matplotlib.figure as mfigure -from mpl_toolkits.axes_grid1 import axes_divider, parasite_axes # type: ignore +from mpl_toolkits.axes_grid1 import axes_divider, parasite_axes # type: ignore[import] def test_simple():