# HG changeset patch # User Jeff Hammel # Date 1332887112 25200 # Node ID f7dc5cf2540c80b6c4834d2baf6b72f5c08c13e5 # Parent 11a498419193c9da844491801354998ffa70df67 add complex test, now we can refactor diff -r 11a498419193 -r f7dc5cf2540c tests/unit.py --- a/tests/unit.py Tue Mar 27 15:00:07 2012 -0700 +++ b/tests/unit.py Tue Mar 27 15:25:12 2012 -0700 @@ -126,5 +126,17 @@ example.parse(args1 + [json_file]) self.assertEqual(example.config, config) + # Now a tricky case: + # the default value for test_timeout is 1200: + example = ExampleConfiguration() + self.assertEqual(example.options['test_timeout']['default'], 1200) + # The value from base.json is 60: + self.assertEqual(json_config['test_timeout'], 60) + self.assertEqual(config['test_timeout'], 60) + # but we can override it back from the "command line" + example.parse(args1 + [json_file, '--test_timeout', '1200']) + config['test_timeout'] = 1200 + self.assertEqual(example.config, config) + if __name__ == '__main__': unittest.main()