]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Relax the Python version check for `__class_getitem__` tests
authorlayday <layday@protonmail.com>
Sun, 19 Sep 2021 15:58:05 +0000 (11:58 -0400)
committersqla-tester <sqla-tester@sqlalchemy.org>
Sun, 19 Sep 2021 15:58:05 +0000 (11:58 -0400)
<!-- Provide a general summary of your proposed changes in the Title field above -->

### Description
`__class_getitem__` to support generics was introduced in Python 3.7.
In 3.9 some built-ins were made generic but the functionality
for user-defined classes has been there since 3.7.

### Checklist
<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)

-->

This pull request is:

- [ ] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [x] A short code fix
- please include the issue number, and create an issue if none exists, which
  must include a complete example of the issue.  one line code fixes without an
  issue and demonstration will not be accepted.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.   one line code fixes without tests will not be accepted.
- [ ] A new feature implementation
- please include the issue number, and create an issue if none exists, which must
  include a complete example of how the feature would look.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.

**Have a nice day!**

Closes: #7049
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7049
Pull-request-sha: 7bd16d416db010e7140313fe326861cc263b8864

Change-Id: I4f45b9585d263636e613cc5c86e710fa31c7d283

lib/sqlalchemy/testing/requirements.py
test/base/test_misc_py3k.py

index 40127addfb4b481f616d3fe404fae3f891b5da7f..f6e79042c99617a133b294b67be0867c2e871536 100644 (file)
@@ -1448,6 +1448,6 @@ class SuiteRequirements(Requirements):
         return exclusions.open()
 
     @property
-    def builtin_generics(self):
-        "If list[int] is a valid syntax. basically py3.9+"
-        return exclusions.only_if(lambda: util.py39)
+    def generic_classes(self):
+        "If X[Y] can be implemented with ``__class_getitem__``. py3.7+"
+        return exclusions.only_if(lambda: util.py37)
index 3cd9e1af4971d829490468b2a333324c8568941a..11e7b9eddab7b7800713e46baa659c8977c2e597 100644 (file)
@@ -4,7 +4,7 @@ from sqlalchemy.testing import requires
 
 
 class TestGenerics(fixtures.TestBase):
-    @requires.builtin_generics
+    @requires.generic_classes
     def test_traversible_is_generic(self):
         col = Column[int]
         assert col is Column