File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 11import difflib
2+ import inspect
23
34import numpy as np
45import sys
@@ -449,7 +450,6 @@ def figure_hook_example(figure):
449450
450451
451452def test_figure_hook ():
452-
453453 test_rc = {
454454 'figure.hooks' : ['matplotlib.tests.test_pyplot:figure_hook_example' ]
455455 }
@@ -484,3 +484,24 @@ def test_matshow():
484484
485485 # Smoke test that matshow does not ask for a new figsize on the existing figure
486486 plt .matshow (arr , fignum = fig .number )
487+
488+
489+ def assert_signatures_identical (plt_meth , original_meth , remove_self_param = False ):
490+ plt_params = inspect .signature (plt_meth ).parameters
491+ original_params = inspect .signature (original_meth ).parameters
492+ if remove_self_param :
493+ if next (iter (original_params )) not in ["self" ]:
494+ raise AssertionError (f"{ original_params } is not an instance method" )
495+
496+ original_params = dict (original_params )
497+ del original_params ["self" ]
498+
499+ assert plt_params == original_params
500+
501+
502+ def test_setloglevel_signature ():
503+ assert_signatures_identical (plt .set_loglevel , mpl .set_loglevel )
504+
505+
506+ def test_polar_signature ():
507+ assert_signatures_identical (plt .polar , plt .Axes .plot , True )
You can’t perform that action at this time.
0 commit comments