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:
Adam Johnson 2021-12-13 15:44:07 +00:00 committed by Mariusz Felisiak
parent 0a4a5e5bac
commit 08d8bccbf1
3 changed files with 33 additions and 14 deletions

View file

@ -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.