Skip to content

Commit 20949e2

Browse files
authored
CLN: do not import Axes/Artist/Figure from matplotlib.pyplot (#55192)
CLN: do not import Axes/Artist from matplotlib.pyplot
1 parent 6a65cfd commit 20949e2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pandas/_testing/asserters.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -416,22 +416,23 @@ def assert_attr_equal(attr: str, left, right, obj: str = "Attributes") -> None:
416416

417417

418418
def assert_is_valid_plot_return_object(objs) -> None:
419-
import matplotlib.pyplot as plt
419+
from matplotlib.artist import Artist
420+
from matplotlib.axes import Axes
420421

421422
if isinstance(objs, (Series, np.ndarray)):
422423
for el in objs.ravel():
423424
msg = (
424425
"one of 'objs' is not a matplotlib Axes instance, "
425426
f"type encountered {repr(type(el).__name__)}"
426427
)
427-
assert isinstance(el, (plt.Axes, dict)), msg
428+
assert isinstance(el, (Axes, dict)), msg
428429
else:
429430
msg = (
430431
"objs is neither an ndarray of Artist instances nor a single "
431432
"ArtistArtist instance, tuple, or dict, 'objs' is a "
432433
f"{repr(type(objs).__name__)}"
433434
)
434-
assert isinstance(objs, (plt.Artist, tuple, dict)), msg
435+
assert isinstance(objs, (Artist, tuple, dict)), msg
435436

436437

437438
def assert_is_sorted(seq) -> None:

0 commit comments

Comments
 (0)