@contextlib.contextmanager<EOL><INDENT>def assertWarns(self, warning, *args, **kwargs):<DEDENT>
original_filters = warnings.filters[:]<EOL>warnings.simplefilter('<STR_LIT:error>')<EOL>if len(args) == <NUM_LIT:0> and len(kwargs) == <NUM_LIT:0>:<EOL><INDENT>with self.assertRaises(warning):<EOL><INDENT>yield<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self.assertRaises(warning, *args, **kwargs)<EOL><DEDENT>warnings.filters = original_filters<EOL>
A test that checks if a specified wanring was raised