obspy.core.util.base.CatchAndAssertWarnings.__init__

CatchAndAssertWarnings.__init__(clear=None, expected=None, show_all=True, **kwargs)[source]
Parameters:
  • clear (list of str) list of modules to clear warning registries on (e.g. ["obspy.signal", "obspy.core"]), in order to make sure any expected warnings will be shown and not suppressed because already raised in previously executed code.
  • expected (list) list of 2-tuples specifying expected warnings that should be looked for when exiting the context manager. An AssertionError will be raised if any expected warning is not encountered. First item in tuple should be the class of the warning, second item should be a regex matching (a part of) the warning message (e.g. (ObsPyDeprecationWarning, 'Attribute .* is deprecated')). Make sure to escape regex special characters like ( or . with a backslash and provide message regex as a raw string.
  • show_all (str) Whether to set warnings.simplefilter('always') when entering context.