mirror of
https://github.com/django/django.git
synced 2025-08-30 15:27:40 +00:00
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:
parent
f273cedc76
commit
cfa26f29bd
3 changed files with 4 additions and 9 deletions
|
@ -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'])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue