8000 Add comment and docstring · matplotlib/matplotlib@bfb0bb5 · GitHub
[go: up one dir, main page]

Skip to content

Commit bfb0bb5

Browse files
committed
Add comment and docstring
1 parent 4236a66 commit bfb0bb5

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lib/matplotlib/testing/decorators.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,23 @@ def tearDownClass(cls):
111111

112112

113113
def cleanup(style=None):
114+
"""
115+
A decorator to ensure that any global state is reset before
116+
running a test.
117+
118+
Parameters
119+
----------
120+
style : str, optional
121+
The name of the style to apply.
122+
"""
123+
124+
# If cleanup is used without arguments, `style` will be a
125+
# callable, and we pass it directly to the wrapper generator. If
126+
# cleanup if called with an argument, it is a string naming a
127+
# style, and the function will be passed as an argument to what we
128+
# return. This is a confusing, but somewhat standard, pattern for
129+
# writing a decorator with optional arguments.
130+
114131
def make_cleanup(func):
115132
@functools.wraps(func)
116133
def wrapped_function(*args, **kwargs):

0 commit comments

Comments
 (0)
0