def test_set_non_existent(self): filters = [Filter(action='test_filter_action'), Filter()] args = {'arg1': 'a', 'arg2': 3, 'arg3': u'abc'} args = { arg_name: Argument(key=arg_name, value=arg_value, format=type(arg_value).__name__) for arg_name, arg_value in args.items() } flag = Flag(parent_name='test_parent', action='test_action', ancestry=['a', 'b'], filters=filters, args=args) flag.set('junkfield', 'junk') self.assertEqual(flag.junkfield, 'junk')
def test_set(self): filters = [Filter(action='test_filter_action'), Filter()] args = {'arg1': 'a', 'arg2': 3, 'arg3': u'abc'} args = { arg_name: Argument(key=arg_name, value=arg_value, format=type(arg_value).__name__) for arg_name, arg_value in args.items() } flag = Flag(parent_name='test_parent', action='test_action', ancestry=['a', 'b'], filters=filters, args=args) flag.set('action', 'renamed_action') self.assertEqual(flag.action, 'renamed_action') flag.set('filters', []) self.assertListEqual(flag.filters, []) flag.set('args', {}) self.assertDictEqual(flag.args, {})