From: Ben Darnell Date: Fri, 17 May 2013 02:56:14 +0000 (-0400) Subject: Add test for option redefinition error. X-Git-Tag: v3.1.0~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e79c0630556125b567f770d9ef7b4eb8dd90662;p=thirdparty%2Ftornado.git Add test for option redefinition error. --- diff --git a/tornado/test/options_test.py b/tornado/test/options_test.py index dc52a82a4..423fc357e 100644 --- a/tornado/test/options_test.py +++ b/tornado/test/options_test.py @@ -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')