comparison tests/unit.py @ 58:f7dc5cf2540c

add complex test, now we can refactor
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 27 Mar 2012 15:25:12 -0700
parents 7f8e9c5d1606
children 2a2e9aee5bc6
comparison
equal deleted inserted replaced
57:11a498419193 58:f7dc5cf2540c
124 # it shouldn't matter in which order the arguments are 124 # it shouldn't matter in which order the arguments are
125 example = ExampleConfiguration() 125 example = ExampleConfiguration()
126 example.parse(args1 + [json_file]) 126 example.parse(args1 + [json_file])
127 self.assertEqual(example.config, config) 127 self.assertEqual(example.config, config)
128 128
129 # Now a tricky case:
130 # the default value for test_timeout is 1200:
131 example = ExampleConfiguration()
132 self.assertEqual(example.options['test_timeout']['default'], 1200)
133 # The value from base.json is 60:
134 self.assertEqual(json_config['test_timeout'], 60)
135 self.assertEqual(config['test_timeout'], 60)
136 # but we can override it back from the "command line"
137 example.parse(args1 + [json_file, '--test_timeout', '1200'])
138 config['test_timeout'] = 1200
139 self.assertEqual(example.config, config)
140
129 if __name__ == '__main__': 141 if __name__ == '__main__':
130 unittest.main() 142 unittest.main()