Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bfb0bb5

Browse filesBrowse files
committed
Add comment and docstring
1 parent 4236a66 commit bfb0bb5
Copy full SHA for bfb0bb5

File tree

Expand file treeCollapse file tree

1 file changed

+17
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+17
-0
lines changed

‎lib/matplotlib/testing/decorators.py

Copy file name to clipboardExpand all lines: lib/matplotlib/testing/decorators.py
+17Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.