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

Skip to content

Commit a3a4957

Browse files
committed
TST: add a test of figure.hooks
1 parent c0f682d commit a3a4957

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/matplotlib/tests/test_pyplot.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,3 +429,18 @@ def test_minor_ticks():
429429
tick_labels = ax.get_yticklabels(minor=True)
430430
assert np.all(tick_pos == np.array([3.5, 6.5]))
431431
assert [l.get_text() for l in tick_labels] == ['a', 'b']
432+
433+
434+
def figure_hook_example(figure):
435+
figure._test_was_here = True
436+
437+
438+
def test_figure_hook():
439+
440+
test_rc = {
441+
'figure.hooks': ['matplotlib.tests.test_pyplot:figure_hook_example']
442+
}
443+
with mpl.rc_context(test_rc):
444+
fig = plt.figure()
445+
446+
assert fig._test_was_here

0 commit comments

Comments
 (0)