From: layday Date: Sun, 19 Sep 2021 15:58:05 +0000 (-0400) Subject: Relax the Python version check for `__class_getitem__` tests X-Git-Tag: rel_1_4_24~7^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b0260bd6706659ee01c33c41f4f7f4c9a8020512;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Relax the Python version check for `__class_getitem__` tests ### 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 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: #` 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: #` 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 --- diff --git a/lib/sqlalchemy/testing/requirements.py b/lib/sqlalchemy/testing/requirements.py index 40127addfb..f6e79042c9 100644 --- a/lib/sqlalchemy/testing/requirements.py +++ b/lib/sqlalchemy/testing/requirements.py @@ -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) diff --git a/test/base/test_misc_py3k.py b/test/base/test_misc_py3k.py index 3cd9e1af49..11e7b9edda 100644 --- a/test/base/test_misc_py3k.py +++ b/test/base/test_misc_py3k.py @@ -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