expected_warnings(matching)
Uses all_warnings
to ensure all warnings are raised. Upon exiting, it checks the recorded warnings for the desired matching pattern(s). Raises a ValueError if any match was not found or an unexpected warning was raised. Allows for three types of behaviors: :None:None:`and`
, :None:None:`or`
, and :None:None:`optional`
matches. This is done to accommodate different build environments or loop conditions that may produce different warnings. The behaviors can be combined. If you pass multiple patterns, you get an orderless :None:None:`and`
, where all of the warnings must be raised. If you use the :None:None:`|`
operator in a pattern, you can catch one of several warnings. Finally, you can use :None:None:`|\A\Z`
in a pattern to signify it as optional.
Regexes for the desired warning to catch If matching is None, this behaves as a no-op.
Context for use in testing to catch known warnings matching regexes
>>> import numpy as npSee :
... image = np.random.randint(0, 2**16, size=(100, 100), dtype=np.uint16)
... # rank filters are slow when bit-depth exceeds 10 bits
... from skimage import filters
... with expected_warnings(['Bad rank filter performance']):
... median_filtered = filters.rank.median(image)
The following pages refer to to this document either explicitly or contain code examples using this.
skimage._shared._warnings.expected_warnings
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them