Reduced reduce() usage; refs #23796.

django.core.exceptions.ValidationError.messages() and
django.db.backends.schema.BaseDatabaseSchemaEditor._alter_field():
Replaced reduce(operator.add, ...) w/uncoupled, explicit sum()
This commit is contained in:
Brad Walker 2014-11-12 16:06:12 -07:00 committed by Tim Graham
parent f273cedc76
commit cfa26f29bd
3 changed files with 4 additions and 9 deletions

View file

@ -6,8 +6,8 @@ from django.core.exceptions import ValidationError
class TestValidationError(unittest.TestCase):
def test_messages_concatenates_error_dict_values(self):
message_dict = {}
with self.assertRaises(TypeError):
ValidationError(message_dict).messages
exception = ValidationError(message_dict)
self.assertEqual(sorted(exception.messages), [])
message_dict['field1'] = ['E1', 'E2']
exception = ValidationError(message_dict)
self.assertEqual(sorted(exception.messages), ['E1', 'E2'])