From 16baec5c8a24ea4bf1bfc27a4c8fea7d0ff4860f Mon Sep 17 00:00:00 2001 From: Joshua Phillips Date: Thu, 21 Jan 2016 16:49:40 +0000 Subject: Fixed #25910 -- Rejected read-only property names in model constructors. --- tests/properties/tests.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/properties') diff --git a/tests/properties/tests.py b/tests/properties/tests.py index 45443026a3..06e30e7b1f 100644 --- a/tests/properties/tests.py +++ b/tests/properties/tests.py @@ -18,6 +18,10 @@ class PropertyTests(TestCase): # The "full_name" property hasn't provided a "set" method. self.assertRaises(AttributeError, setattr, self.a, 'full_name', 'Paul McCartney') + # And cannot be used to initialize the class. + with self.assertRaisesMessage(TypeError, "'full_name' is an invalid keyword argument"): + Person(full_name='Paul McCartney') + # But "full_name_2" has, and it can be used to initialize the class. a2 = Person(full_name_2='Paul McCartney') a2.save() -- cgit v1.3