Lines Matching refs:warnings
4 This module has a number of tests that raise different kinds of warnings.
5 When the tests are run, the warnings are caught and their messages are printed
7 unittest.main to affect the behavior of warnings.
9 combinations of warnings args and -W flags and check that the output is correct.
15 import warnings
18 warnings.warn('rw', RuntimeWarning)
21 # unittest warnings will be printed at most once per type (max one message
36 # these warnings are normally silenced, but they are printed in unittest
38 warnings.warn('dw', DeprecationWarning)
39 warnings.warn('dw', DeprecationWarning)
40 warnings.warn('dw', DeprecationWarning)
43 warnings.warn('iw', ImportWarning)
44 warnings.warn('iw', ImportWarning)
45 warnings.warn('iw', ImportWarning)
47 # user warnings should always be printed
49 warnings.warn('uw')
50 warnings.warn('uw')
51 warnings.warn('uw')
53 # these warnings come from the same place; they will be printed
64 with warnings.catch_warnings(record=True) as ws:
65 # if an arg is provided pass it to unittest.main as 'warnings'
67 unittest.main(exit=False, warnings=sys.argv.pop())