Skip to content

Commit

Permalink
Tests for Axes and Axes3D __repr__
Browse files Browse the repository at this point in the history
  • Loading branch information
scottshambaugh committed Jul 21, 2022
1 parent 9dc445b commit c419cef
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ def test_get_labels():
assert ax.get_ylabel() == 'y label'


def test_repr():
fig, ax = plt.subplots()
ax.set_label('label')
ax.set_title('title')
ax.set_xlabel('x')
ax.set_ylabel('y')
assert repr(ax) == ("<AxesSubplot:label='label', " +
"title={'center':'title'}, xlabel='x', ylabel='y'>")


@check_figures_equal()
def test_label_loc_vertical(fig_test, fig_ref):
ax = fig_test.subplots()
Expand Down
13 changes: 13 additions & 0 deletions lib/mpl_toolkits/tests/test_mplot3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ def test_aspect_equal_error():
ax.set_aspect('equal')


def test_axes3d_repr():
fig = plt.figure()
ax = fig.add_subplot(projection='3d')
ax.set_label('label')
ax.set_title('title')
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
assert repr(ax) == ("<Axes3DSubplot:label='label', " +
"title={'center':'title'}, " +
"xlabel='x', ylabel='y', zlabel='z'>")


@mpl3d_image_comparison(['bar3d.png'])
def test_bar3d():
fig = plt.figure()
Expand Down

0 comments on commit c419cef

Please sign in to comment.