diff options
author | sobolevn <mail@sobolevn.me> | 2020-02-02 13:15:58 +0300 |
---|---|---|
committer | Carlton Gibson <carlton@noumenal.es> | 2020-04-15 11:26:11 +0200 |
commit | 578c03b276e435bcd3ce9eb17b81e85135c2d3f3 (patch) | |
tree | d5d50b835a1c244d91f939dfc0d84e3ae0c5e2cb /tests/model_inheritance | |
parent | fc0b48d2e7aaaeb390936916f56dc0631717d022 (diff) | |
download | django-578c03b276e435bcd3ce9eb17b81e85135c2d3f3.tar.gz |
Fixed #31223 -- Added __class_getitem__() to Manager and QuerySet.
Diffstat (limited to 'tests/model_inheritance')
-rw-r--r-- | tests/model_inheritance/tests.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/model_inheritance/tests.py b/tests/model_inheritance/tests.py index 3568c538f0..60edaa3d99 100644 --- a/tests/model_inheritance/tests.py +++ b/tests/model_inheritance/tests.py @@ -1,9 +1,11 @@ from operator import attrgetter +from unittest import skipUnless from django.core.exceptions import FieldError, ValidationError from django.db import connection, models from django.test import SimpleTestCase, TestCase from django.test.utils import CaptureQueriesContext, isolate_apps +from django.utils.version import PY37 from .models import ( Base, Chef, CommonInfo, GrandChild, GrandParent, ItalianRestaurant, @@ -217,6 +219,12 @@ class ModelInheritanceTests(TestCase): self.assertSequenceEqual(qs, [p2, p1]) self.assertIn(expected_order_by_sql, str(qs.query)) + @skipUnless(PY37, '__class_getitem__() was added in Python 3.7') + def test_queryset_class_getitem(self): + self.assertIs(models.QuerySet[Post], models.QuerySet) + self.assertIs(models.QuerySet[Post, Post], models.QuerySet) + self.assertIs(models.QuerySet[Post, int, str], models.QuerySet) + class ModelInheritanceDataTests(TestCase): @classmethod |