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 1
1
import difflib
2
+ import inspect
2
3
3
4
import numpy as np
4
5
import sys
@@ -449,7 +450,6 @@ def figure_hook_example(figure):
449
450
450
451
451
452
def test_figure_hook ():
452
-
453
453
test_rc = {
454
454
'figure.hooks' : ['matplotlib.tests.test_pyplot:figure_hook_example' ]
455
455
}
@@ -484,3 +484,24 @@ def test_matshow():
484
484
485
485
# Smoke test that matshow does not ask for a new figsize on the existing figure
486
486
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