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

Skip to content

Commit 58572ce

Browse files
committed
Created test for previous issue
test will make two calls two set_tick_params. After the fix the second call should not change any of the ticks color or size values.
1 parent a202c2c commit 58572ce

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4335,6 +4335,25 @@ def test_pandas_indexing_hist():
43354335
fig, axes = plt.subplots()
43364336
axes.hist(ser_2)
43374337

4338+
@cleanup
4339+
def test_axis_set_tick_params_two_calls():
4340+
# Tests fix for issue 4346
4341+
axis_1 = plt.subplot()
4342+
axis_1.yaxis.set_tick_params(labelsize=30, labelcolor='red', direction='out')
4343+
4344+
# Expected values after setting the ticks
4345+
assert axis_1.yaxis.majorTicks[0]._size == 4.0
4346+
assert axis_1.yaxis.majorTicks[0]._color == 'k'
4347+
assert axis_1.yaxis.majorTicks[0]._labelsize == 30.0
4348+
assert axis_1.yaxis.majorTicks[0]._labelcolor == 'red'
4349+
4350+
# This second call to set_tick_params should not change any parameters
4351+
axis_1.yaxis.set_tick_params()
4352+
4353+
assert axis_1.yaxis.majorTicks[0]._size == 4.0
4354+
assert axis_1.yaxis.majorTicks[0]._color == 'k'
4355+
assert axis_1.yaxis.majorTicks[0]._labelsize == 30.0
4356+
assert axis_1.yaxis.majorTicks[0]._labelcolor == 'red'
43384357

43394358
if __name__ == '__main__':
43404359
import nose

0 commit comments

Comments
 (0)