diff options
author | Tim Graham <timograham@gmail.com> | 2016-07-30 20:50:09 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-30 20:50:09 -0400 |
commit | 5fa4370543658aedd79dc554d8c52684d6c7cbca (patch) | |
tree | 719003137fd14f586e417e7ceb5651736265ba03 /tests/many_to_many | |
parent | 4e861682904744b0ea3ead8552513c6f1a826c5a (diff) | |
download | django-5fa4370543658aedd79dc554d8c52684d6c7cbca.tar.gz |
Refs #25550 -- Corrected deprecation message for assigning M2M relations.
Diffstat (limited to 'tests/many_to_many')
-rw-r--r-- | tests/many_to_many/tests.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/many_to_many/tests.py b/tests/many_to_many/tests.py index 67b3c9601e..86ffe816eb 100644 --- a/tests/many_to_many/tests.py +++ b/tests/many_to_many/tests.py @@ -400,15 +400,24 @@ class ManyToManyTests(TestCase): self.a4.publications.set([], clear=True) self.assertQuerysetEqual(self.a4.publications.all(), []) - def test_assign_deprecation(self): + def test_assign_forward_deprecation(self): msg = ( - "Direct assignment to the reverse side of a related set is " + "Direct assignment to the reverse side of a many-to-many set is " "deprecated due to the implicit save() that happens. Use " "article_set.set() instead." ) with self.assertRaisesMessage(RemovedInDjango20Warning, msg): self.p2.article_set = [self.a4, self.a3] + def test_assign_reverse_deprecation(self): + msg = ( + "Direct assignment to the forward side of a many-to-many " + "set is deprecated due to the implicit save() that happens. Use " + "publications.set() instead." + ) + with self.assertRaisesMessage(RemovedInDjango20Warning, msg): + self.a1.publications = [self.p1, self.p2] + @ignore_warnings(category=RemovedInDjango20Warning) def test_assign_deprecated(self): self.p2.article_set = [self.a4, self.a3] |