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

Skip to content

Commit 51634e7

Browse files
committed
TST: add title round-trip test
1 parent 8f1339f commit 51634e7

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4112,7 +4112,6 @@ def test_violin_point_mass():
41124112
plt.violinplot(np.array([0, 0]))
41134113

41144114

4115-
41164115
@cleanup
41174116
def test_axisbg_warning():
41184117
fig = plt.figure()
@@ -4133,6 +4132,20 @@ def test_dash_offset():
41334132
plt.show()
41344133

41354134

4135+
@cleanup
4136+
def test_title_location_roundtrip():
4137+
fig, ax = plt.subplots()
4138+
ax.set_title('aardvark')
4139+
ax.set_title('left', loc='left')
4140+
ax.set_title('right', loc='right')
4141+
4142+
assert_equal('left', ax.get_title(loc='left'))
4143+
assert_equal('right', ax.get_title(loc='right'))
4144+
assert_equal('aardvark', ax.get_title())
4145+
4146+
assert_raises(ValueError, ax.get_title, loc='foo')
4147+
assert_raises(ValueError, ax.set_title, 'fail', loc='foo')
4148+
41364149

41374150
if __name__ == '__main__':
41384151
import nose

0 commit comments

Comments
 (0)