def test_exclude_keys(self): exclude_keys = ['one'] key_values = {'one': 1, 'two': 2} new_keys = utils.exclude(key_values, *exclude_keys) self.assertEqual(len(new_keys), 1) self.assertEqual(new_keys, {'two': 2})
def _extract_required_params(self, params, model_name): params = params or {} model_params = params.get(model_name, {}) return utils.stringify_keys(utils.exclude(model_params, *self.exclude_attr))
def test_empty_exclude(self): self.assertEqual(utils.exclude(None), None)
def test_exclude_keys(self): exclude_keys = ['one'] key_values = {'one': 1, 'two': 2 } new_keys = utils.exclude(key_values, *exclude_keys) self.assertEqual(len(new_keys), 1) self.assertEqual(new_keys, {'two': 2 })
def update(self, **values): attrs = utils.exclude(values, *self._auto_generated_attrs) self.merge_attributes(attrs) result = self.save() # self._notify_fields("update") return result