]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Add test for option redefinition error.
authorBen Darnell <ben@bendarnell.com>
Fri, 17 May 2013 02:56:14 +0000 (22:56 -0400)
committerBen Darnell <ben@bendarnell.com>
Fri, 17 May 2013 02:56:14 +0000 (22:56 -0400)
tornado/test/options_test.py

index dc52a82a4992e6749130b5e522780c3989f1db11..423fc357e670abd2d1893d8777323ad548b5963b 100644 (file)
@@ -169,3 +169,11 @@ class OptionsTest(unittest.TestCase):
         options.define('foo', type=int, multiple=True)
         options.parse_command_line(['main.py', '--foo=1,3,5:7'])
         self.assertEqual(options.foo, [1, 3, 5, 6, 7])
+
+    def test_error_redefine(self):
+        options = OptionParser()
+        options.define('foo')
+        with self.assertRaises(Error) as cm:
+            options.define('foo')
+        self.assertRegexpMatches(str(cm.exception),
+                                 'Option.*foo.*already defined')