Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c419cef

Browse files
Tests for Axes and Axes3D __repr__
1 parent 9dc445b commit c419cef

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ def test_get_labels():
5959
assert ax.get_ylabel() == 'y label'
6060

6161

62+
def test_repr():
63+
fig, ax = plt.subplots()
64+
ax.set_label('label')
65+
ax.set_title('title')
66+
ax.set_xlabel('x')
67+
ax.set_ylabel('y')
68+
assert repr(ax) == ("<AxesSubplot:label='label', " +
69+
"title={'center':'title'}, xlabel='x', ylabel='y'>")
70+
71+
6272
@check_figures_equal()
6373
def test_label_loc_vertical(fig_test, fig_ref):
6474
ax = fig_test.subplots()

lib/mpl_toolkits/tests/test_mplot3d.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ def test_aspect_equal_error():
3434
ax.set_aspect('equal')
3535

3636

37+
def test_axes3d_repr():
38+
fig = plt.figure()
39+
ax = fig.add_subplot(projection='3d')
40+
ax.set_label('label')
41+
ax.set_title('title')
42+
ax.set_xlabel('x')
43+
ax.set_ylabel('y')
44+
ax.set_zlabel('z')
45+
assert repr(ax) == ("<Axes3DSubplot:label='label', " +
46+
"title={'center':'title'}, " +
47+
"xlabel='x', ylabel='y', zlabel='z'>")
48+
49+
3750
@mpl3d_image_comparison(['bar3d.png'])
3851
def test_bar3d():
3952
fig = plt.figure()

0 commit comments

Comments
 (0)