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

Skip to content

Commit ac5f694

Browse files
tacaswellanntzer
authored andcommitted
TST: add a test of figure.hooks
1 parent e6eecba commit ac5f694

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
@@ -440,3 +440,18 @@ def test_switch_backend_no_close():
440440
assert len(plt.get_fignums()) == 2
441441
plt.switch_backend('svg')
442442
assert len(plt.get_fignums()) == 0
443+
444+
445+
def figure_hook_example(figure):
446+
figure._test_was_here = True
447+
448+
449+
def test_figure_hook():
450+
451+
test_rc = {
452+
'figure.hooks': ['matplotlib.tests.test_pyplot:figure_hook_example']
453+
}
454+
with mpl.rc_context(test_rc):
455+
fig = plt.figure()
456+
457+
assert fig._test_was_here

0 commit comments

Comments
 (0)