summaryrefslogtreecommitdiff
path: root/tests/many_to_one_null
diff options
context:
space:
mode:
authorAlexandr Tatarinov <tatarinov1997@gmail.com>2018-06-23 23:39:22 +0300
committerTim Graham <timograham@gmail.com>2018-06-25 13:04:46 -0400
commit741061852851d6aff8e35f46b0e165685d3e79e0 (patch)
tree5dd3015bcb1b1e2ac4e84846921b2cf490e608c9 /tests/many_to_one_null
parent6b3e17bab61b94a307d5b276480f8a0e125cb2e5 (diff)
downloaddjango-741061852851d6aff8e35f46b0e165685d3e79e0.tar.gz
Fixed #29447 -- Made RelatedManager.set() pass bulk argument to clear().
Diffstat (limited to 'tests/many_to_one_null')
-rw-r--r--tests/many_to_one_null/tests.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/many_to_one_null/tests.py b/tests/many_to_one_null/tests.py
index 77b8fd7c25..6ccabefe66 100644
--- a/tests/many_to_one_null/tests.py
+++ b/tests/many_to_one_null/tests.py
@@ -85,6 +85,11 @@ class ManyToOneNullTests(TestCase):
['<Article: Fourth>', '<Article: Second>', '<Article: Third>']
)
+ def test_set_clear_non_bulk(self):
+ # 2 queries for clear(), 1 for add(), and 1 to select objects.
+ with self.assertNumQueries(4):
+ self.r.article_set.set([self.a], bulk=False, clear=True)
+
def test_assign_clear_related_set(self):
# Use descriptor assignment to allocate ForeignKey. Null is legal, so
# existing members of the set that are not in the assignment set are