diff options
Diffstat (limited to 'Lib/test/test_warnings.py')
-rw-r--r-- | Lib/test/test_warnings.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py index 5d051a5..a7ccb6b 100644 --- a/Lib/test/test_warnings.py +++ b/Lib/test/test_warnings.py @@ -81,6 +81,19 @@ class TestModule(unittest.TestCase): self.assertEqual(msg.message, text) self.assertEqual(msg.category, 'UserWarning') + def test_options(self): + # Uses the private _setoption() function to test the parsing + # of command-line warning arguments + self.assertRaises(warnings._OptionError, + warnings._setoption, '1:2:3:4:5:6') + self.assertRaises(warnings._OptionError, + warnings._setoption, 'bogus::Warning') + self.assertRaises(warnings._OptionError, + warnings._setoption, 'ignore:2::4:-5') + warnings._setoption('error::Warning::0') + self.assertRaises(UserWarning, warnings.warn, 'convert to error') + + def test_main(verbose=None): # Obscure hack so that this test passes after reloads or repeated calls # to test_main (regrtest -R). |