diff options
author | Hasan Ramezani <hasan.r67@gmail.com> | 2020-10-05 11:51:35 +0200 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-10-05 12:25:05 +0200 |
commit | 981a3426cf2f54f5282e79fb7f47726998c87cb2 (patch) | |
tree | 337e2a107e06415dc9d99b746b2d2430f3d4399a /tests/queries/test_qs_combinators.py | |
parent | 7cfa40d87286a7fb19331f856e25183a2f914b36 (diff) | |
download | django-981a3426cf2f54f5282e79fb7f47726998c87cb2.tar.gz |
Fixed #32068 -- Added error messages on get() with filters following union(), intersection(), and difference().
Diffstat (limited to 'tests/queries/test_qs_combinators.py')
-rw-r--r-- | tests/queries/test_qs_combinators.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/queries/test_qs_combinators.py b/tests/queries/test_qs_combinators.py index 1029e40ed8..5a10196da5 100644 --- a/tests/queries/test_qs_combinators.py +++ b/tests/queries/test_qs_combinators.py @@ -341,3 +341,16 @@ class QuerySetSetOperationTests(TestCase): msg % (operation, combinator), ): getattr(getattr(qs, combinator)(qs), operation)() + + def test_get_with_filters_unsupported_on_combined_qs(self): + qs = Number.objects.all() + msg = 'Calling QuerySet.get(...) with filters after %s() is not supported.' + combinators = ['union'] + if connection.features.supports_select_difference: + combinators.append('difference') + if connection.features.supports_select_intersection: + combinators.append('intersection') + for combinator in combinators: + with self.subTest(combinator=combinator): + with self.assertRaisesMessage(NotSupportedError, msg % combinator): + getattr(qs, combinator)(qs).get(num=2) |