From: Violet Folino Gallo <48537601+galloviolet@users.noreply.github.com> Date: Thu, 17 Jul 2025 16:16:30 +0000 (-0700) Subject: linter stuff X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=baa70bf269564cc942cd50691e874a7611f3e5d7;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git linter stuff --- diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index 91fb2e5b66..916e506563 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -4321,14 +4321,16 @@ class _FrameClause(ClauseElement): except (ValueError, TypeError) as ve: raise exc.ArgumentError("2-tuple expected for range/rows") from ve + lower_type_engine: TypeEngine[Any] + upper_type_engine: TypeEngine[Any] if isinstance(lower_value, int): - lower_type = type_api.INTEGERTYPE + lower_type_engine = type_api.INTEGERTYPE else: - lower_type = type_api.NUMERICTYPE + lower_type_engine = type_api.NUMERICTYPE if isinstance(upper_value, int): - upper_type = type_api.INTEGERTYPE + upper_type_engine = type_api.INTEGERTYPE else: - upper_type = type_api.NUMERICTYPE + upper_type_engine = type_api.NUMERICTYPE if lower_value is None: self.lower_type = _FrameClauseType.RANGE_UNBOUNDED @@ -4338,10 +4340,10 @@ class _FrameClause(ClauseElement): self.lower_bind = None elif lower_value < 0: self.lower_type = _FrameClauseType.RANGE_PRECEDING - self.lower_bind = literal(abs(lower_value), lower_type) + self.lower_bind = literal(abs(lower_value), lower_type_engine) else: self.lower_type = _FrameClauseType.RANGE_FOLLOWING - self.lower_bind = literal(lower_value, lower_type) + self.lower_bind = literal(lower_value, lower_type_engine) if upper_value is None: self.upper_type = _FrameClauseType.RANGE_UNBOUNDED @@ -4351,10 +4353,10 @@ class _FrameClause(ClauseElement): self.upper_bind = None elif upper_value < 0: self.upper_type = _FrameClauseType.RANGE_PRECEDING - self.upper_bind = literal(abs(upper_value), upper_type) + self.upper_bind = literal(abs(upper_value), upper_type_engine) else: self.upper_type = _FrameClauseType.RANGE_FOLLOWING - self.upper_bind = literal(upper_value, upper_type) + self.upper_bind = literal(upper_value, upper_type_engine) class WithinGroup(ColumnElement[_T]): diff --git a/lib/sqlalchemy/testing/requirements.py b/lib/sqlalchemy/testing/requirements.py index 6fbf4786e1..a4782c1e91 100644 --- a/lib/sqlalchemy/testing/requirements.py +++ b/lib/sqlalchemy/testing/requirements.py @@ -1884,4 +1884,4 @@ class SuiteRequirements(Requirements): @property def window_range_numeric(self): """Target backend supports fractional values in RANGE""" - return exclusions.closed() \ No newline at end of file + return exclusions.closed() diff --git a/lib/sqlalchemy/testing/suite/test_select.py b/lib/sqlalchemy/testing/suite/test_select.py index 19979ab392..551b3259d2 100644 --- a/lib/sqlalchemy/testing/suite/test_select.py +++ b/lib/sqlalchemy/testing/suite/test_select.py @@ -45,7 +45,6 @@ from ... import union from ... import values from ...exc import DatabaseError from ...exc import ProgrammingError -from ...sql.elements import _FrameClauseType class CollateTest(fixtures.TablesTest): @@ -1957,7 +1956,6 @@ class WindowFunctionTest(fixtures.TablesTest): ).all() eq_(rows, [(i,) for i in range(1, 20)]) - @testing.requires.window_range_numeric def test_window_range_numeric(self, connection): @@ -1974,7 +1972,6 @@ class WindowFunctionTest(fixtures.TablesTest): eq_(rows, [(i + 0.5,) for i in range(1, 20)]) - def test_window_rows_between_w_caching(self, connection): some_table = self.tables.some_table diff --git a/test/requirements.py b/test/requirements.py index c1a576b220..955e19ffe9 100644 --- a/test/requirements.py +++ b/test/requirements.py @@ -2131,5 +2131,5 @@ class DefaultRequirements(SuiteRequirements): @property def window_range_numeric(self): - """Target database supports window functions with fractional RANGE values""" - return fails_on(["mssql"]) \ No newline at end of file + """Target database supports fractional RANGE values""" + return fails_on(["mssql"])