mirror of
https://github.com/django/django.git
synced 2025-10-25 14:46:09 +00:00
Improved Model.__init__() properties loop.
This improves readability, accumulates unrecognized arguments raise an exception with all of them, and avoids refetching the values.
This commit is contained in:
committed by
Mariusz Felisiak
parent
0a4a5e5bac
commit
08d8bccbf1
@@ -18,7 +18,7 @@ class PropertyTests(TestCase):
|
||||
setattr(self.a, 'full_name', 'Paul McCartney')
|
||||
|
||||
# And cannot be used to initialize the class.
|
||||
with self.assertRaisesMessage(TypeError, "Person() got an unexpected keyword argument 'full_name'"):
|
||||
with self.assertRaises(AttributeError):
|
||||
Person(full_name='Paul McCartney')
|
||||
|
||||
# But "full_name_2" has, and it can be used to initialize the class.
|
||||
|
||||
Reference in New Issue
Block a user