From 2cd516002d43cdc09741618f0a0db047ee6d78fd Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Thu, 12 Apr 2012 20:23:41 +0000 Subject: Fixed #18002 -- Fixed typo in attribute name in ReverseSingleRelatedObjectDescriptor. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17904 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/many_to_one_regress/tests.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/regressiontests/many_to_one_regress/tests.py b/tests/regressiontests/many_to_one_regress/tests.py index 9e04fb4542..481a037139 100644 --- a/tests/regressiontests/many_to_one_regress/tests.py +++ b/tests/regressiontests/many_to_one_regress/tests.py @@ -58,6 +58,10 @@ class ManyToOneRegressionTests(TestCase): self.assertRaises(ValueError, Child, name='xyzzy', parent=None) self.assertRaises(ValueError, Child.objects.create, name='xyzzy', parent=None) + # Trying to assign to unbound attribute raises AttributeError + self.assertRaisesRegexp(AttributeError, "must be accessed via instance", + Child.parent.__set__, None, p) + # Creation using keyword argument should cache the related object. p = Parent.objects.get(name="Parent") c = Child(parent=p) -- cgit v1.3