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

Skip to content

Commit cd4c42b

Browse files
committed
STY: condense code a bit
1 parent 922b57f commit cd4c42b

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lib/matplotlib/testing/decorators.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ def test_plot(fig_test, fig_ref):
381381
fig_test.subplots().plot([1, 3, 5])
382382
fig_ref.subplots().plot([0, 1, 2], [1, 3, 5])
383383
"""
384+
POK = inspect.Parameter.POSITIONAL_OR_KEYWORD
384385

385386
def decorator(func):
386387
import pytest
@@ -410,18 +411,14 @@ def wrapper(*args, ext, **kwargs):
410411
for param in sig.parameters.values()
411412
if param.name not in {"fig_test", "fig_ref"}
412413
]
413-
+ [
414-
inspect.Parameter(
415-
"ext", inspect.Parameter.POSITIONAL_OR_KEYWORD
416-
)
417-
]
414+
+ [inspect.Parameter("ext", POK)]
418415
)
419416
)
420417
wrapper.__signature__ = new_sig
421418

422419
# reach a bit into pytest internals to hoist the marks from
423420
# our wrapped function
424-
new_marks = getattr(func, 'pytestmark', []) + wrapper.pytestmark
421+
new_marks = getattr(func, "pytestmark", []) + wrapper.pytestmark
425422
wrapper.pytestmark = new_marks
426423

427424
return wrapper

0 commit comments

Comments
 (0)